This is a discussion on print order of associatve array within the PHP General forums, part of the PHP Programming Forums category; Ive got a series of 2 dimensional associative arrays while(list($key, $val) = each ($results)) { {foreach($val as $i=>$...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Ive got a series of 2 dimensional associative arrays
while(list($key, $val) = each ($results)) { {foreach($val as $i=>$v) print "$i = $v"; } } but i want to define the order that the various $i's are printed in (not numerical/alphabetically) arrays named "key1_sorted_order" = keys in the order to be printed "key2_sorted_order" ive been experimeting with while(list($key, $val) = each ($results)) { {foreach($val as $i=>$v) $ks=$i.'_sorted_order'; ($cntr=0;cntr<count($ks);$i++ ) { print [$ks[$i]] =$results[$val[$ks[$i]]] ;} } } anyone able tohelp me out ? |