You are here: Re: Dereferencing Variables in PHP « PHP Programming Language « IT news, forums, messages
Re: Dereferencing Variables in PHP

Posted by Norman Peelman on 05/15/05 03:47

"Shannon A." <appel@erzo.org> wrote in message
news:1116096102.753079.138950@g44g2000cwa.googlegroups.com...
> I have a set of variables called $topten_1, $topten_2, $topten_3, etc.
>
> I'd like to use a for($i = 1 ; $i<=10 ; $i++) loop to reference them,
> but can't quite figure out how to. These don't work:
>
> $topten_$1
> ${topten_$1}
> $"topten_$1"
>
> Is there someway to do this in PHP, or is the only answer to use an
> associative array?
>
> Shannon
>

Close... try:

${"topten_$i"}



Norm
---
FREE Avatar hosting at www.easyavatar.com

 

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

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