You are here: php String Evaluation Issue... « All PHP « IT news, forums, messages
php String Evaluation Issue...

Posted by number1.email on 12/12/05 02:45

I have an array with the following values:

$q[0] = 100;
$q[1] = 200;
$q[2] = 300;
$q[3] = 400;

If I execute the following statement:

echo $q[2];

The expected answer of 300 is displayed on the screen.

I'm trying to print out the contents of this array in a for loop,
so I'd like to be able to build up the variable using the index of the
for loop.

For example;

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

So, I would like the output of this for loop to be 100200300400 when it
has completed.

This doesn't seem to work...can anyone supply me with the right
statement (ie: $param3 = ${ "$q[" . $i . "]" }; ) that will work?

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

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