|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-04-04 11:21 UTC] kalle@php.net
-Status: Open
+Status: Not a bug
[2019-04-04 11:21 UTC] kalle@php.net
[2019-04-04 14:34 UTC] baklouti dot med at gmail dot com
[2019-04-04 14:37 UTC] spam2 at rhsoft dot net
[2019-04-04 14:50 UTC] baklouti dot med at gmail dot com
[2019-04-11 21:21 UTC] a at b dot c dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 02:00:01 2025 UTC |
Description: ------------ I am testing the value of $id to do some processing. I retrieve the variable $id from an array ($test) and converted to integer, for the case that $id = 0 when using "switch" it can't be detected and if I used the "if" it is working fine. I tried with the "==" and the "===" and also not working with "switch". I am not using the two cases in the same time, i tested the "if" and "switch" separately. $id = (integer)$test['id']; if ($id === 0 ) {return 1;} switch ($id) { case ($id === 0): return 2; .... Expected result: ---------------- The expected result is the bloc inside the case ($id ===0) is processed. Actual result: -------------- The actual result that it is passed for another case.