Hi Kevin,
I find it a bit awkward to mix variables and arrays in a pseudo
array. But I guess you have reasons...
Anyhow, maybe this is what you want:
$variable1="one";
$variable2="two";
$variable3 = array();
$variable3[0]="three";
$variable4 = array();
$variable4[0]="four";
$j=1;
while($j<5){
if (is_array(${"variable".$j})) {
print(${"variable".$j}[0] . "<br />");
} else {
print(${"variable".$j} . "<br />");
};
$j++;
}
Timo
Am Freitag den, 6. September 2002, um 20:37, schrieb Kevin Heflin:
> Hoping someone can help me with this. Below I have an example
> of what I'm trying to accomplish.
> Bottom line.. I need to print out $variable3[0] and $variable4[0]
> and my problem is that I'm trying to generate the variable
> name. I can get this to work with $variable1 and $variable2
> which are not arrays, however that doesn't help me much.
>
> Any suggestions would be appreciated.
>
> Kevin
>
>
>
> <?
> $variable1="one";
> $variable2="two";
> $variable3[0]="three";
> $variable4[0]="four";
>
> $j=1;
> while($j<5){
> print("${variable.$j} <BR>");
> $j++;
> }
>
>
> $j=1;
> while($j<5){
> $k="\$variable".$j."[0]";
> print("$k <BR>");
> print("${variable.$k} <BR>");
> $j++;
> }
> ?>
>
>
> -- PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php