I need some help in figuring something out. In one of my scripts, I run 3-4 for loops each having a different condition set in them.
I've decided to save on some time that I'll store the conditions in an array and run it through a foreach loop that then runs each of the conditions through a for loop.
Unfortunately, I'm having problems in storing the conditions in the array because when I run it through the for loop it gives me a parse error. Here's a basic example of what I want to do...
CODE
<?php
// Sample code
$condition['first'] = array("$i = 0; $i < 12; $i++", "echo $i;");
$condition['second'] = array("$cellcount = 0; $cellcount % $somevariable != 12; $cellcount++", "echo "It should print out the cell count".$cellcount);
$condition['etc'] = etc....
foreach($condition as $key => $array)
{
list($for_value, $for_output) = $array;
for($for_value)
{
$for_output;
$somevariable++;
}
}
?>
// Sample code
$condition['first'] = array("$i = 0; $i < 12; $i++", "echo $i;");
$condition['second'] = array("$cellcount = 0; $cellcount % $somevariable != 12; $cellcount++", "echo "It should print out the cell count".$cellcount);
$condition['etc'] = etc....
foreach($condition as $key => $array)
{
list($for_value, $for_output) = $array;
for($for_value)
{
$for_output;
$somevariable++;
}
}
?>
Any suggestions on how to go about doing this? Like how I should store my conditions in the array or something? My brain's just fried and I need an outsider's opinion on how to go about this
Thanks