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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sokkis at gmail dot com
New email:
PHP Version: OS:

 

 [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 11:01:30 2024 UTC