Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 01-23-2006, 03:21 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
Sunrise, Sunset (with php)

I stumbled across some interesting functions last week.

date_sunrise()
date_sunset()

they return a unix timestamp of the sunrise and sunset in php5. kinda cool.
sde is offline   Reply With Quote
Old 01-24-2006, 05:48 PM   #2 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
Not to be negative or anything, but sometimes I wish more of php's builtin functions were library functions with real namespaces rather than prefix namespaces (eg Date:sunrise vs date_sunrise or MySQL:query vs mysql_query)
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 01-24-2006, 06:27 PM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
why? then it would be called java or .net
sde is offline   Reply With Quote
Old 01-24-2006, 06:41 PM   #4 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
I just like languages with small cores and good library support that's all. PHP's core does what good libraries do, but it's a pretty big core.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 01-24-2006, 06:51 PM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
I think PHP has both. A good core and then lots of other libraries you can add. Maybe it's not organized in namespaces, but they do organize similar functions in the PHP manual for reference.

I think PHP would not be PHP if it you had to do things like include a datetime namespace and instanciate a time object.
sde is offline   Reply With Quote
Old 01-24-2006, 07:11 PM   #6 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
I never said anything about objects! I was more thinking of the ways you add libraries in C or perl. But yeah php does have a sort of eclectic charm.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 01-24-2006, 07:14 PM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
oh my bad, i always associated namespaces with OO. it does have an addon library structure, but i suppose they are added per PHP installation vs at the application level.
sde is offline   Reply With Quote
Old 02-02-2006, 09:03 PM   #8 (permalink)
Admin
$_['Your_Mom'];
 
Admin's Avatar
 
Join Date: May 2002
Location: Santee
Posts: 627
Admin is on a distinguished road
that's neat

although i still run 4 cause i'm lame*



*lame = i dont want to break old scripts, hooray.
__________________


Urban Clothing
Admin is offline   Reply With Quote
Old 02-02-2006, 09:15 PM   #9 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
hey matt!

i haven't upgraded yet because i'm afraid to break hosting customer's sites. one of these days i'm just going to have to give plenty of warning and just do it.
sde is offline   Reply With Quote
Old 02-03-2006, 04:22 AM   #10 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 673
DJMaze is on a distinguished road
Perl alike ?
Code:
function use($classname)
{
    include($classname.'.php');
}

use('datetime');
datetime::sunrise()
datetime::sunset()
Code:
class datetime
{
    public static function sunrise()
    {
        return date_sunrise();
    }
    public static function sunset()
    {
        return date_sunset();
    }
}
DJMaze is offline   Reply With Quote
Old 02-03-2006, 09:13 PM   #11 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
The point isn't that I want to call it as library::function, it's just that the standard php namespace seems a little crowded sometimes. That's a neat trick though.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 04-11-2006, 06:17 AM   #12 (permalink)
ChefFrank
Code Monkey
 
ChefFrank's Avatar
 
Join Date: Mar 2006
Location: Woodbury, CT
Posts: 38
ChefFrank is on a distinguished road
Send a message via Yahoo to ChefFrank
These functions rock! I actually took some time to look up the underlying algorithms and, it's MUCH easier just to call this function. Now, if someone would come up with a function that could give moonrise and moonset . . . . THOSE calculations are freeky!!!!!

Frank
ChefFrank is offline   Reply With Quote
Old 04-14-2006, 08:49 PM   #13 (permalink)
dave-php
Registered User
 
Join Date: Apr 2006
Posts: 2
dave-php is on a distinguished road
Eclectic ?

Quote:
Originally Posted by teknomage1
I never said anything about objects! I was more thinking of the ways you add libraries in C or perl. But yeah php does have a sort of eclectic charm.
Don't give in so easy !

Dave
dave-php is offline   Reply With Quote
Old 04-14-2006, 09:07 PM   #14 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
Hehe, welcome, Dave.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make a search engine for your website with PHP zhisede PHP 3 10-25-2005 07:54 AM
PHP 5.0.4 and 4.3.11 Released sde Code Newbie News 0 04-20-2005 10:56 AM
PHP to Flash control panel roccoman PHP 1 11-24-2004 08:10 AM
PHP vs .NET Redline Lounge 1 11-24-2004 06:10 AM
I need to learn PHP Nitro PHP 9 06-28-2003 11:24 AM


All times are GMT -8. The time now is 06:50 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting