Re: variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- Original Message ----
> From: Grega Leskovšek <legrega@xxxxxxxxx>
> To: php-general@xxxxxxxxxxxxx
> Sent: Thursday, September 24, 2009 10:10:33 AM
> Subject:  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 ;)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux