Date and time functions

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
landi
php-forum Active User
php-forum Active User
Posts: 386
Joined: Thu Mar 15, 2012 3:59 pm

Re: Date and time functions

Post by landi » Sat Aug 09, 2014 3:30 am

Hi,
It's because 08 is treated as an invalid octal number (it's a throwback to C - numbers starting with a leading 0 are treated as octal numbers). 07 happens to work because 07(base8) == 7 (base 10)
This will work:

Code: Select all

echo checkdate(8, 01, 2014) ? 'true':'false';
So will this:

Code: Select all

echo checkdate('08', 01, 2014) ? 'true':'false';
-A

landi
php-forum Active User
php-forum Active User
Posts: 386
Joined: Thu Mar 15, 2012 3:59 pm

Re: Date and time functions

Post by landi » Sat Aug 09, 2014 9:47 am

Hi,

1) $_SERVER['HTTP_REFERER'] is not guarenteed to be set (see docs). You can test first with isset()

2) Not sure why you expect any other result:

Code: Select all

unset($b); // b is now an undefined variable
-A

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests