|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-12-03 01:16 UTC] chregu@php.net
[2002-12-03 20:39 UTC] rosewell at cnk dot com dot cn
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 20 17:00:01 2025 UTC |
<?php $a = 'center'; switch ($a) { case 'left': case 0: echo 'left';break; case 'right': case 2: echo 'right';break; default:echo 'center'; } ?> The script should generate 'center',yet generate 'left';what's more,any string assigned to variable $a will generate the same error. The reason is the PHP scripting engine cannot distinguish a string with integer 0. I wonder if the switch statement can only be applied on integers.