<?php // Test for switch not running default code when array element key is 0 if there is a mix of array keys that are numerical along with a string array key $test = array(0 => "First element, should be 0",1 => "Second element, should be 1",2 => "Third element, should be 2","Three" => "Fourth element, should be Three"); print_r($test); foreach($test as $k => $v) { switch($k) { case "Three": echo "not to be printed\n"; break; default: echo $k.": ".$v."\n"; break; } } ?>
You have javascript disabled. You will not be able to edit any code.