Re: [nyphp-talk] Weird Switch Behavior

2008-09-13 Thread Glenn
Interesting and subtle code. IMHO, the best solution is to make sure every hash item has a key/value pair when the hash is created. Someone may have to work with the code in the future and if the hash creation is done in some required/included file like a class, it might be more time consuming to

[nyphp-talk] Weird Switch Behavior

2008-09-09 Thread Michael B Allen
Can someone explain why the below switch matches the 0 element? $ cat switch.php 1, 'bar' => 2, 'zap', ); foreach ($tmp as $key => $val) { switch ($key) { case 'foo': case 'bar': echo "[$key][$val]\n";