Re: variable

From: Date: Thu, 24 Sep 2009 17:18:30 +0000
Subject: Re: variable
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-298328@lists.php.net to get a copy of this message
----- Original Message ---- > From: Tommy Pham <tommyhp2@yahoo.com> > To: Grega Leskovšek <legrega@gmail.com>; php-general@lists.php.net > Sent: Thursday, September 24, 2009 10:16:44 AM > Subject: Re: [PHP] variable > > ----- Original Message ---- > > From: Grega Leskovšek > > To: php-general@lists.php.net > > Sent: Thursday, September 24, 2009 10:10:33 AM > > Subject: [PHP] variable > > > > Suppose I have a variable $i = 0 or 1 or 2 > > and I have variables $item0, $item1 and $item2 > > how do I print the variable $item0 using a combination of variable $item and > > variable $i? > > or with this code it gives me an error: > > $i = 0; > > $item0 = "test"; > > echo $item$i; #how do I properly use this variable $item with $i? > > > > Thanks in advance, Yours, Grega > > > > > > -- Peace refuge: http://users.skavt.net/~gleskovs/ > > When the sun rises I receive and when it sets I forgive;) Grega Leskovšek > > ${'item'$i} ? Why not use array? Thus, $item[$i], simplify your life ;) > Typed too slow... my mistake. It should be: ${'item' . $i} > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#298328) next »