array_filter function in php - PHP Views : 180
Tagged in : PHP
0 0
Send mail
Suppose we have an array $a like this

Array ( [0] => abc [1] => dcf [2] => [3] => [4] => [5] => )

Here we need to check whether the array element is empty and pop that element.

We can easily achieve this by array_filter()

print_r(array_filter($a));

The output will be

Array ( [0] => abc [1] => dcf )

We can also write call back functions that can be passed as a parameter to array_filter() function.
By banumathi, On - 2011-08-30



    Login to add Comments .