Re: foreach in php4

From: Date: Tue, 05 Jul 2005 21:44:57 +0000
Subject: Re: foreach in php4
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-218159@lists.php.net to get a copy of this message
On Mon, July 4, 2005 10:40 pm, Dotan Cohen said: > $pre_arr = array(1, 2, 3, 4); > $arr = array(); foreach ($pre_arr as $key=>$value) { $pre_arr[$key] = $value * 2; //> $arr[] = $value * 2; > } > // $arr is now array(2, 4, 6, 8) > > Is there a better way? Thanks. Whether that's better or not depends on what you mean by "better"... :-) PS I dunno if I got the foreach syntax right or not. Never use it. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#218159) next »