Posted by Angelos on 03/14/06 12:41
Angelos wrote:
> Hello,
>
> I need to dynamically specify the name of a variable. I just read that
> $varA = "Cat";
> echo $$varA;
>
> OUTPUT: Cat
SOrry That was wrong example;
THats a correct one;
$varA = "dog";
$$varA = "jack";
echo "Dog name is: ".$dog;
OUTPUT: Dog name is: jack
>
> What I try to establish is somehow add a bit of text on my dynamic
> variable name.
> so:
>
> $varA = "Cat";
> $$varA.'Food' <------ I am not sure what should be the syntax in order
> the variable name to be $CatFood
>
> The reason I want to do that is because I take the first part of the
> variable name from a Database.
>
> Thanks.
Navigation:
[Reply to this message]
|