Re: Dynamic Variables with a counter

From: Date: Tue, 12 Sep 2000 09:08:00 +0000
Subject: Re: Dynamic Variables with a counter
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16297@lists.php.net to get a copy of this message
webmaster@realgm.com ("Real GM Webmaster") writes: > What I am now trying to do is have a counter, counter1, which starts at 101 for the first > section. Having a while statement, I could then remove 24 of these if statements (the insides of > these are fairly long for formatting the output), and I would have to add the $p to the counter in > the hope of it giving me the player id. (value currently assigned to $p101, $p102, etc). > > I have tried a number of different things, all without success. > > Some of the things I have tried are below: > > $counter1=101; > $value=$("p".$counter1); Close... $value = ${"p$counter1"}; or $value = ${"p".$counter1}; -- Robin Vickery............................................... Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK Email: robin@planet-three.net Phone: +44 (0)870 729 5444

« previous php.general (#16297) next »