maharg
Technical User
- Mar 21, 2002
- 184
Hi
I'm new to PHP and can't seem to get my syntax right here.
This little test code should print out as ....
1,2,3,4,5,6,Graham,
2,4,6,8,10,12,Edward,
10,20,30,40,50,60,James,
41,42,43,44,45,46,Gordon,
But it doesnt.
My error is in the line print_r($person$n[$i]);
to do with how I'm concantenating $person and $n
Can anyone help me find a solution?
Thanks in advance!!
Graham
I'm new to PHP and can't seem to get my syntax right here.
This little test code should print out as ....
1,2,3,4,5,6,Graham,
2,4,6,8,10,12,Edward,
10,20,30,40,50,60,James,
41,42,43,44,45,46,Gordon,
But it doesnt.
My error is in the line print_r($person$n[$i]);
to do with how I'm concantenating $person and $n
Can anyone help me find a solution?
Thanks in advance!!
Graham
Code:
<html>
<body>
<?php
$person1 = array(1,2,3,4,5,6, "Graham");
$person2 = array(2,4,6,8,10,12, "Edward");
$person3 = array(10,20,30,40,50,60, "James");
$person4 = array(41,42,43,44,45,46, "Gordon");
$n=1;
while($n<=4){
$i=0;
while($i<=6)
{
print_r($person$n[$i]);
echo ",";
$i++;
}
echo "<br />";
$n++;}
?>
</body>
</html>