Hi, I have 1 primary array called $item containing 20 values each of whose
value is part of the name of 20 other arrays containing various number of
values. How can I cycle through the primary $item array using a foreach and
within that do a for on each of the 20 secondary arrays dynamically
inserting each of the 20 secondary array names based on the value of the
current primary $item array. Something like the following which obviously
does not work.
<?php
foreach($item as $value) {
// do some stuff
for($i=0; $i<count($"beginning_of_array_name_always_the_same" . $value .
"end_of_array_name_always_the_same"); $i++) {
// do some stuff
}
}
?>
I am trying to avoid doing something like the following ...
<?php
foreach($item as $value) {
// do some stuff
if($value == 'red'){
$array = $temp_red_file;
} elseif ($value == 'green'){
$array = $temp_green_file;
// and so on for all 20 possibilities
}
for($i=0; $i<count($array); $i++) {
// do some stuff
}
}
?>
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php