Skip to content

Instantly share code, notes, and snippets.

@raphaeldealmeida
Created February 22, 2012 13:44
Show Gist options
  • Save raphaeldealmeida/1885222 to your computer and use it in GitHub Desktop.
Save raphaeldealmeida/1885222 to your computer and use it in GitHub Desktop.
sem closure
<?php
$lista = array(1, 3, 5, 7, 56, 65, 96, 244, 700, 892);
$filtro100 = function ($x){
return $x > 100;
};
$filtro50 = function ($x){
return $x > 50;
};
//output: array(244, 700, 892)
array_filter($lista, $filtro100);
//output: array(56, 65, 96, 244, 700, 892)
array_filter($lista, $filtro50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment