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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to