RE: [PHP] Create Array??

From: Date: Sun, 23 Sep 2001 06:19:30 +0000
Subject: RE: [PHP] Create Array??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68397@lists.php.net to get a copy of this message
> -----Original Message----- > From: KPortsmout@aol.com [mailto:KPortsmout@aol.com] > Sent: Sunday, 23 September 2001 15:39 > To: php-general@lists.php.net > Subject: [PHP] Create Array?? > > > Hi, > > If I have a value $num = 32; based on this how can I create an Array of > numbers 1 - 32, something like this... > > <? > $num = "32"; $num = 32; $iary = array(); > for ($i = 1; $i <= $num; $i++) > { $iary[$i] = $i; // if you actually wanted the array to contain "1" etc then try // $iary[$i] = "\"$i\""; > // Do something > } // And now $iary = ("1","2","3",etc var_dump($iary); > ?> > > Any suggestions?? I cannot use array_push as this has to work on a PHP3 > server. > > TIA > Ade

« previous php.general (#68397) next »