Bug #67480 [Opn->Nab]: String E conversion to numbers.

From: Date: Thu, 19 Jun 2014 17:46:06 +0000
Subject: Bug #67480 [Opn->Nab]: String E conversion to numbers.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186264@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67480&edit=1 ID: 67480 Updated by: requinix@php.net Reported by: madu dot rapa at gmail dot com Summary: String E conversion to numbers. -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: ALL PHP Version: 5.4.29 Block user comment: N Private report: N New Comment: I don't get that notice. Are you sure you have $x='E' and not $x=E? To the point, string <=> integer comparison works by converting the string to an integer; (int)'E' is 0, thus 'E'==0. If you want strict inequality then use !==. http://www.php.net/manual/en/types.comparisons.php Previous Comments: ------------------------------------------------------------------------ [2014-06-19 15:11:15] madu dot rapa at gmail dot com Description: ------------ <?php $x='E'; // Assignment of Parameter if ( $x!='0') // Check if the value is '0' (string) { echo "False"; } else { echo "TRUE"; } ?> Above code returns False while below code returns TRUE for the if condition with a warning message --> Notice: Use of undefined constant E - assumed 'E' <?php $x='E'; // Assignment of Parameter if ( $x!=0) // Check if the value is 0 (integer) { echo "False"; } else { echo "TRUE"; } ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67480&edit=1

« previous php.bugs (#186264) next »