Re: FW: Array problem

From: Date: Mon, 19 Nov 2001 09:59:53 +0000
Subject: Re: FW: Array problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75084@lists.php.net to get a copy of this message
Well, I tried the following script which works: <?php $i = 0; while ($i < 5) { $x[$i] = 1; $i++; } $i = 0; while($x[$i]) { echo value ".$i.": ".$x[$i]."<br>"; $i++; } ?> but the following does not: <?php //$i = 0; while ($i < 5) { $x[$i] = 1; $i++; } $i = 0; while($x[$i]) { echo value ".$i.": ".$x[$i]."<br>"; $i++; } ?> That is the same code as yours. It generates an array in the first while loop and prints each value in the second one.

« previous php.general (#75084) next »