php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61561 0=='0000-00-00' is true
Submitted: 2012-03-30 09:58 UTC Modified: 2012-03-30 10:16 UTC
From: sokkis at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.10 OS: Gentoo
Private report: No CVE-ID: None
 [2012-03-30 09:58 UTC] sokkis at gmail dot com
Description:
------------
'0000-00-00' is equal with '000-00-00'. I think is false, because i have two "-" 
in the string.

Test script:
---------------
<?php echo 0=='0000-00-00'; ?>

Expected result:
----------------
0

Actual result:
--------------
1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-30 10:00 UTC] sokkis at gmail dot com
I wrote some mistake.

'0000-00-00' is equal with 0. I think is false, because i have two "-" 
in the string.
 [2012-03-30 10:16 UTC] yohgaki@php.net
-Status: Open +Status: Not a bug
 [2012-03-30 10:16 UTC] yohgaki@php.net
use ===

It's a type juggling. 
http://jp.php.net/manual/en/language.types.type-juggling.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC