Write a PHP program to filter the collection using the given callback
<?php //Licence: https://bit.ly/2CFA5XY function reject($items, $func) { return array_values(array_diff($items, array_filter($items, $func))); } print_r(reject(['Green', 'Red', 'Black', 'White'], function ($item) { return strlen($item) > 4; })); ?>
Sample Output:
Array ( [0] => Red )
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
Array ( [0] => Red )need an explanation for this answer? contact us directly to get an explanation for this answer