Using the isset() function to see whether an array element is defined for a given index. : isset « Data Type « PHP






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("&middot; %s,", $array[$i]); 
?>
  
  








Related examples in the same category

1.Checking PHP's global authentication variables
2.Checking Whether a Variable Is Set: isset( )
3.bool isset ( mixed var [, mixed var [, ...]] ) returns true if its parameter has been set
4.Viewing the username cookie