At 9/7/2002, you wrote:
>the example I have below.. I'm able to get working using the 'echo' command.
>But I would like to know how to format the same using the 'print' command.
>I am familiar with both. but with this one instance I am not sure how to
>format the print command correctly to get the same results as the echo
>command. Any suggestions would be appreciated.
>
> $variable1[0]="one";
> $variable2[0]="two";
> $variable3[0]="three";
> $variable4[0]="four";
>
> $j=1;
> while($j<5){
> echo ${"variable"."$j"}[0];
> $j++;
> }
Hi,
I don't get it, it works identically with echo and with print, doesn't it?
$variable1[0]="one";
$variable2[0]="two";
$variable3[0]="three";
$variable4[0]="four";
$j=1;
while($j<5){
print ${"variable"."$j"}[0];
$j++;
}
If you get kicks from odd coding styles you might also use eval :)
$variable1[0]="one";
$variable2[0]="two";
$variable3[0]="three";
$variable4[0]="four";
$j=1;
while($j<5){
eval("print \"\$variable" . $j . "[0]<br>\";");
$j++;
}
-------------------------
Pekka Saarinen
http://photography-on-the.net
-------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php