|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-05-31 18:51 UTC] nlopess@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 09:00:02 2025 UTC |
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