RE: [PHP] array_filter function
| From: | Bagus Nugroho | Date: | Fri, 28 Mar 2008 16:03:04 +0000 |
| Subject: | RE: [PHP] array_filter function | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-272240@lists.php.net to get a copy of this message | ||
Thanks You,
rgds, bnug
________________________________
From: Robin Vickery [mailto:robinv@gmail.com]
Sent: Jumat 28-Mar-2008 21:45
To: Bagus Nugroho
Cc: php-general@lists.php.net
Subject: Re: [PHP] array_filter function
On 28/03/2008, Bagus Nugroho <bnugroho@unisemgroup.com> wrote:
> Hello,
>
> If I have an array like this
> $dataArray = array(0=>array('type'=>'da'),
> 1=>array('type'=>'wb'), 2=>array('type'=>'da');
>
> How I can filtering to get only 'da' only, like this
>
> $newDataArray =
> array(0=>array('type'=>'da'),2=>array('type'=>'da'))
$newDataArray = array_filter($dataArray, create_function('$a','return
$a["type"] == "da";'));