Q:

Write a PHP program to filter out the elements of a given array, that have one of the specified values

0

Write a PHP program to filter out the elements of a given array, that have one of the specified values.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
//Licence: https://bit.ly/2CFA5XY

function without($items, ...$params)
{
    return array_values(array_diff($items, $params));
}
print_r(without([2, 1, 2, 3], 1, 2));

?>

Sample Output:

Array
(
    [0] => 3
)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now