Thanks for your fast reply.
One more question related to this topic.
Would it be valueable to extend the existing array_values() function to support this 
feature?
just to balance with array_keys() and its optional value argument.

----- Original Message ----- 
From: "Markus Fischer" <[EMAIL PROTECTED]>
To: "Gyozo Papp" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: 2001. május 23. 00:14
Subject: Re: [PHP] select specified elements from an array


> On Wed, May 23, 2001 at 12:06:42AM +0200, Gyozo Papp wrote : 
> > function array_part($fromarray, $keys)
> > {
> >     foreach($fromarray as $key => $val)
> >     {
> >         if (in_array($key, $keys)
> >            $anotherarray[$key] = $val;
> >     }
> >     return $anotherarray;
> > }
> 
> foreach( $keys as $key)
> if( isset( $fromarray[ $key]))
> $anotherarray[ $key] = $fromarray[ $key];
> 
> - Markus
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to