Reply to Re: Problem Evaluating Strings ...

Your name:

Reply:


Posted by jamen on 12/11/05 18:28

number1.email@gmail.com wrote:
> I'm passing into a .php file the following:
>
> I have an array called $q[], which has the contents:
>
> $q[0] = 2
> $q[1] = 4
> $q[2] = 5
> $q[3] = 3
>
> Also, there are variables:
> $quest1 = "First"
> $quest2 = "Second"
> $quest3 = "Third"
> $quest4 = "Fourth"
> $quest5 = "Fifth"
>
> I'd like to be able to loop through this array (ie: $q[]) via a for
> loop, and create the name of the other variables from the contents (ie:
> $quest4 by concatenating "$quest" + $q[1] , $quest5 by concatenating
> "$quest" + $q[2] , etc.). In addition, I'd like to be able to execute
> these variables and echo the contents back to the screen (ie: for
> $quest1...echo "First", for $quest2...echo "Second", etc.

for($i=0; $i<4; $i++){
echo ${"quest".$q[$i]};
}

[Back to original 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

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