Mega Code Archive

 
Categories / Php / Data Type
 

Looping Through a Sparse Array

<?php  error_reporting();  $array = array('a' => 'R', 'b' => 2, c => '2');  foreach($array as $element)      print("$element,");  $limit = count($array);  for($i = 0; $i < $limit; $i++)      printf("%s,", $array[$i]);  ?>