Re: Make switch/case to type sensitive comparison in PH P 5?
| From: | Michael Sims | Date: | Thu, 27 Mar 2003 02:17:27 +0000 |
| Subject: | Re: Make switch/case to type sensitive comparison in PH P 5? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-357@lists.php.net to get a copy of this message | ||
On Wed, 26 Mar 2003 17:08:25 -0000, you wrote:
>Choosing between "case 0:" and (say) "case_identical 0:" would only be the
>same as choosing between == and === in an if statement -- it would just give
>the opportunity to do it using the elegant switch structure instead of the
>clumsy if...elseif...else chain.
Why not something like this:
$a = 0;
switch (true) {
case ($a === 'somestring'):
...
break;
case ($a === 0):
...
break;
}
It's not pretty, but you might like it better than
if...elseif...else...