Using the isset() function to see whether an array element is defined for a given index.
<?php
$array = array('a' => 'R', 'b' => 2, c => '2');
print "<p>Using for:</p>\n<p>";
$limit = count($array);
for($i = 0; $i < $limit; $i++)
if( isset($array[$i]) )
printf("· %s,", $array[$i]);
?>
Related examples in the same category