note 102246 added to control-structures.switch

From: Date: Thu, 03 Feb 2011 18:09:33 +0000
Subject: note 102246 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-176657@lists.php.net to get a copy of this message
NEED HELP! So I'm using the switch statement like this: switch($state) { case ($state === 204): if ($state == 0) { $transactions['Success'] += $cnt; echo "THIS GETS PRINTED!"; break; } $transactions['Fail'] += $cnt; $transactions['SOAP Error (204)'] += $cnt; break; } The echo actually gets printed! How is this possible? I did the strict and the loose compare and both give the same results! This is making me go crazy! Please help! ---- Server IP: 69.147.83.197 Probable Submitter: 96.45.197.22 ---- Manual Page -- http://www.php.net/manual/en/control-structures.switch.php Edit -- https://master.php.net/note/edit/102246 Del: integrated -- https://master.php.net/note/delete/102246/integrated Del: useless -- https://master.php.net/note/delete/102246/useless Del: bad code -- https://master.php.net/note/delete/102246/bad+code Del: spam -- https://master.php.net/note/delete/102246/spam Del: non-english -- https://master.php.net/note/delete/102246/non-english Del: in docs -- https://master.php.net/note/delete/102246/in+docs Del: other reasons-- https://master.php.net/note/delete/102246 Reject -- https://master.php.net/note/reject/102246 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#176657) next »