I want to echo the array $tables[1] and array $tables[2]. I have && signs to show what I'm trying to do.
This obviously doesn't work, but how can I get it to work?
preg_match_all('/(<table id="friendtable(..).{150,180}font-size:.?.?.?.?pt">)<a/', $text, $tables);
foreach($tables[1] as $whole && $tables[2] as $number)
{
echo $whole;
echo $number;
}
multiple arrays in a foreach statement
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
You could run through them separately and then merge them.
And then echo them together via the $tmp array. I'm not sure if the increment in the second loop should happen on the left or right side of the assignment... You should take a look into it.
Code: Select all
$tmp = array();
$index = 0;
foreach($table[1] as $value)
{
$tmp[$index++] = $value;
}
$index = 0;
foreach($table[2] as $value)
{
$tmp[$index++] = array($tmp[$index], $value);
}