#37656 [Opn->Csd]: Incorrect switch example

From: Date: Wed, 31 May 2006 18:51:03 +0000
Subject: #37656 [Opn->Csd]: Incorrect switch example
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969373151@lists.php.net to get a copy of this message
ID: 37656 Updated by: nlopess@php.net Reported By: stevepburke at hotmail dot com -Status: Open +Status: Closed Bug Type: Documentation problem PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2006-05-31 16:50:15] stevepburke at hotmail dot com Description: ------------ In the documentation for the 'switch' statement, there is an example by scott at firefallpro dot com dated 22-Dec-2005 03:01. In his second example, it doesn't seem to work properly unless the switch statement is "switch(true)" and not "switch($x)" Reproduce code: --------------- Example: <?php $x = 0; switch($x) { case $x === "a": echo "a"; break; case $x === "b": echo "b"; break; default echo "default"; } ?> Expected result: ---------------- default Actual result: -------------- a ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37656&edit=1

« previous php.doc (#969373151) next »