Bug #68649 [Opn->Nab]: ECHO

From: Date: Fri, 26 Dec 2014 05:22:21 +0000
Subject: Bug #68649 [Opn->Nab]: ECHO
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189210@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68649&edit=1 ID: 68649 Updated by: requinix@php.net Reported by: vusalhaqverdiyev at gmail dot com Summary: ECHO -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Linux PHP Version: 5.4Git-2014-12-24 (Git) Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2014-12-26 00:40:47] php at mcq8 dot be This is not a bug. The echo of FALSE RESULT is due to type juggling.(http://php.net/manual/en/language.types.type-juggling.php) The string "test" gets converted to 0. You can use if($a === "test"){ to compare types as well. (http://be2.php.net/manual/en/language.operators.comparison.php) ------------------------------------------------------------------------ [2014-12-24 22:27:50] vusalhaqverdiyev at gmail dot com Description: ------------ $a = 0; if($a == "test"){ echo "FALSE RESULT"; } else{ echo "TRUE RESULT"; } In this code snippet, $a = 0, and the "if" must not launch. But "if" is launched. Test script: --------------- $a = 0; if($a == "test"){ echo "FALSE RESULT"; } else{ echo "TRUE RESULT"; } In this code snippet, $a = 0, and the "if" must not launch. But "if" is launched. Expected result: ---------------- $a = 0; if($a == "test"){ echo "FALSE RESULT"; } else{ echo "TRUE RESULT"; } In this code result must be "True result" Actual result: -------------- $a = 0; if($a == "test"){ echo "FALSE RESULT"; } else{ echo "TRUE RESULT"; } In this code result must be "True result" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68649&edit=1

« previous php.bugs (#189210) next »