Write a PHP program to mutate the original array to filter out the values specified
<?php //Licence: https://bit.ly/2CFA5XY function pull(&$items, ...$params) { $items = array_values(array_diff($items, $params)); return $items; } $items = ['a', 'b', 'c', 'a', 'b', 'c']; print_r(pull($items, 'a', 'c')); ?>
Sample Output:
Array ( [0] => b [1] => b )
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] => b [1] => b )need an explanation for this answer? contact us directly to get an explanation for this answer