Re: PHP Variables

From: Date: Wed, 23 Aug 2000 15:16:18 +0000
Subject: Re: PHP Variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13177@lists.php.net to get a copy of this message
On Thu, 24 Aug 2000, Scott Mebberson wrote: > What I want to do is set a variable with $newItemX and then get X replaced > by $i everytime the movie loops. Does anyone use Macromedia Flash here. If I > was using flash I would go > > Set Variable: "$newsItem"&$i = $text Similar, but in php use the . to concat the strings: <?php for($i=1;$i<10;$i++) { $var = "var$i"; $$var = "Hans Anderson $i"; } print $var5; ?> $var5 was randomly chosen by me, but demonstrates the method. It might be easier just to use an array, though. Hans > For the example $i can be equal to 3, and $text can be equal to 'hello > world' so > > $newsItem3 = 'hello world' Check the docs for variable variables. Hans Anderson ~ me@hansanderson.com PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia, http://www.hansanderson.com | Killer Audio Production, http://www.goofiness.com | Minty Fresh Breath.

« previous php.general (#13177) next »