..


Sponsored Links

array_filter

The function array_filer filters the elements of an array using a user-made function.
More precisely, the function passes each value of the array (passed in argument) to a user-made function (which returns true or false) and produces an array only if the return value is true.

The accepted parameters are:

  • array (Required)
    And 'the array on which to filter;
  • function (Required)
    Name of the function made by the user.
Here's an example:





 miofiltro function ($ v)

 





 {



  



 if ($ v === "Mouse") return true;



  



 else return false;







 }







 $ Arr = array (0 => "Dog", 1 => "Cat", 2 => "Rat");







 print_r (array_filter ($ arr, "miofiltro"));



'S output of the code above will be:
 



 Array (



  



 [2] => Rat







 )

 

In the same category ...
E-Learning
Linux (Course) Linux (Course)
Complete guide to open-source system. From 49 €.
MySQL (Course) MySQL (Course)
Management of open-source database. From 39 €.
PHP (Course) PHP (Course)
Full course for creating dynamic Web sites. From 49 €.
Sponsored Links