Posted by number1.email on 12/11/05 12:59
In php, I have an array called "q". The elements are:
$q[0] = 2
$q[1] = 4
$q[2] = 5
$q[3] = 3
I'd like to be able to loop through this array via a While loop, and
echo the contents of these array elements back to the screen.
When I try something like:
for($i = 0; $i < 4; $i++) {
echo $q[i];
echo eval("$q[i]");
echo eval("\$q[" . i . "]");
}
I get the "String" instead of the "Contents". For example, the output
is $q[0] instead of 2, $q[1] instead of 4, etc.
How can I fix this? Thanks.
[Back to original message]
|