..
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:
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 )
| |
Linux (Course)
Complete guide to open-source system. From 49 €. |
| |
MySQL (Course)
Management of open-source database. From 39 €. |
| |
PHP (Course)
Full course for creating dynamic Web sites. From 49 €. |