Looping Through a Sparse Array : Array Loop « Data Structure « PHP

Looping Through a Sparse Array

$array = array('a' => 'R', 'b' => 2, c => '2'); 

foreach($array as $element) 

$limit = count($array); 
for($i = 0; $i < $limit; $i++) 
    printf("%s,", $array[$i]); 


Related examples in the same category

1.Using foreach to Iterate through an Array
2.Looping through an Enumerated Array
3.Looping Through a Compact Indexed Array Using for and count()
4.Looping Through a Multidimensional Array
5.Looping Through an Associative Array with foreach
6.Looping Through the $_SERVER Array
7.Looping through child elements with foreach()
8.Looping through identically named elements with foreach()
9.Looping with foreach()
10.List array values