From:             [EMAIL PROTECTED]
Operating system: Red Hat Linux 7.2
PHP version:      4.2.2
PHP Bug Type:     Documentation problem
Bug description:  strtotime example in docs incorrect

The docs for strtotime contain a code snippet that is supposed to catch
invalid dates. It fails in this example where $str is set to "1970-1-222"
and invalid date.

$str = "1970-1-222";
if (($timestamp = strtotime($str)) === -1) {
  echo "The string ($str) is bogus";
}
else {
  echo "$str == ". date('l dS of F Y h:i:s A',$timestamp);
}

The output is:

1970-1-222 == Monday 10th of August 1970 12:00:00 AM

Whereas is should say that 1970-1-222 is a bogus date.

Jc

-- 
Edit bug report at http://bugs.php.net/?id=19166&edit=1
-- 
Try a CVS snapshot:  http://bugs.php.net/fix.php?id=19166&r=trysnapshot
Fixed in CVS:        http://bugs.php.net/fix.php?id=19166&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=19166&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=19166&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=19166&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19166&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=19166&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=19166&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=19166&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=19166&r=globals


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

Reply via email to