Using the array_filter() Function : array_filter « Data Structure « PHP






Using the array_filter() Function

 
<?php

    function filter_values($value) {
        if($value > 10) return true;
        return false;
    }

    $myints = array(123,45,2345,3,42);
    $filtered = array_filter($myints, "filter_values");
    print_r($filtered);
?>
  
  








Related examples in the same category

1.Array filter
2.Filtering Arrays Using array_filter()
3.array_filter demo
4.array_filter( ) filters elements through a function