Organizational Research By

Surprising Reserch Topic

Question:how you could easily delete a specific value from an array with array_filter using php



asked Sep 13, 2013 in PHP by rajesh
edited Sep 12, 2013
+1 vote
25 views



Related Hot Questions

1 Answer

0 votes

 

$array = array (1, 3, 3, 5, 6); 
$my_value = 3; 
$filtered_array = array_filter($array, function ($element) use ($my_value) { return ($element != $my_value); } ); 
print_r($filtered_array); 
?> 
 
output: 
 
Array 
( 
    [0] => 1 
    [3] => 5 
    [4] => 6 
)
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013

...