Following my unsolved question,
I'm trying to figure how to use foreach
How can I make this kind of code:
$m1="mbob";
$m2="mdan";
$m3="mbill";
$a = array('bob', 'dan', 'bill');
$i = 1; /* for illustrative purposes only */
foreach ($a as $v) {
echo "\$a[$i] => $v.\n";
echo $m[$i];
$i++;
}
To output this result:
$a[1] => bob.
mbob
$a[2] => dan.
mdan
$a[3] => bill.
mbill
I'm getting the error:
Undefined variable: m
But I'm trying to output the m1,m2,m3 variables, not just m.