php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14240 IF behaving weird
Submitted: 2001-11-26 15:32 UTC Modified: 2001-11-26 15:35 UTC
From: kvzp at novae dot dhs dot org Assigned:
Status: Closed Package: *General Issues
PHP Version: 4.0.6 OS: Linux RedHat 7.1
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: kvzp at novae dot dhs dot org
New email:
PHP Version: OS:

 

 [2001-11-26 15:32 UTC] kvzp at novae dot dhs dot org
$foo = "foo";

if ( "foo" == 0 )
{ echo "1"; }

if ( $foo == 0 )
{ echo "2"; }


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-26 15:35 UTC] derick@php.net
This prints "12" for me, which is what I would expect. A string evaluates to 0 upon conversion to an integer. You should use === to check for both type and value.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Sep 16 20:01:27 2024 UTC