Re: Self generating variables/arrays

From: Date: Sun, 26 Nov 2006 13:21:02 +0000
Subject: Re: Self generating variables/arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-245147@lists.php.net to get a copy of this message
# jekillen@prodigy.net / 2006-11-25 22:19:05 -0800: > Hello; > I am writing some code that will format results of a search for display. > I need to split an array into several different arrays but I won't know > before hand how many, so, I am looking for a way to dynamically > generate arrays for this purpose. > My present direction is to use the following code: > > for($i = 0; $i < $c; $i++) > { eval('$a_'.$i.' = array();'); } what's wrong with: for($i = 0; $i < $c; $i++) { $a[$i] = array(); } -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991

« previous php.general (#245147) next »