You are here: Re: Dynamic Variable Name $$var « PHP Programming Language « IT news, forums, messages
Re: Dynamic Variable Name $$var

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация