Reply to Re: Variable in a variable name

Your name:

Reply:


Posted by Sjoerd on 04/13/06 14:09

Garry Jones wrote:
> This by recycling the code with $personX in and changing the value of x and
> running the code ten times. Probably in some kind of do while loop (fairly
> new to php, but I have been using Excel VB for years and am familiar with
> the syntax and effectiveness of Do While Loops).

You probably want to use arrays, which are variables which can contain
multiple values.
$personage[1] = 'John';
$personage[2] = 'Gerry';

You can use $personage[1] as you would use any other variable. You can
loop through this array with:
foreach ($personage as $person) {
echo $person;
}
This would print "JohnGerry".

See
http://nl2.php.net/manual/en/language.types.array.php
for more information about arrays.

It is possible in PHP to have variable variables (e.g. specify the name
of the variable in another variable), but it is almost never what you
want.

[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

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