[PHP] strtotime returns 00:00 for 7am

2007-06-20 Thread Phil Princely

Hi all
I'm new to this list. I hope this hasn't been discussed already.

using this code:

function test_time($time_string) {
   echo strftime("%X %A, %b %e\n", strtotime($time_string));
}

test_time('now');
test_time('4pm + 2 Hours');
test_time('now + 2 fortnights');
test_time('last Monday');
test_time('tomorrow');
test_time('5am tomorrow');
test_time('7am 12 days ago');

gives this output:

21:46:18 Wednesday, Jun 20

18:00:00 Wednesday, Jun 20

21:46:18 Wednesday, Jul 18

00:00:00 Monday, Jun 18

00:00:00 Thursday, Jun 21

00:00:00 Thursday, Jun 21

07:00:00 Friday, Jun  8


I'm wondering why the 2nd and 3rd last both give 00:00 as the
time. Especially why 5am tomorrow doesn't work. Using PHP5.


Thanks


Phil P.


[PHP] magic quotes

2007-07-17 Thread Phil Princely

Hi all,

I've been having a problem with a setting on a test server and
production server. My test server has magic_quotes_gpc off, but the
production server has it turned on. I've no access to the php.ini for
the production server and don't want to change the setting on my test
server.

Searching on the internet, I found some ways to deal with this kind of thing:

use a .htaccess file to turn magic_quotes off by saving a text file
with the line:

magic_quotes_gpc off

Or making a function to strip slashes like this:

if (magic_quote_gpc()) {
stripslashes_array($_GET);
stripslashes_array($_POST);
stripslashes_array($_REQUEST);
stripslashes_array($_COOKIE);
}

What do people on this list usually do with this kind of problem. To
me, the .htaccess seems the easiest solution, since I don't have to
change any scripts.

cheers

Phil P.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php