Created
September 27, 2010 14:35
-
-
Save wchristian/599131 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array[0] = array(1600,1601,1602,1603); | |
$array[1] = array(1601,1602,1603,1604); | |
$array[2] = array(1602,1603,1604,1605); | |
$num_filter = make_filter( "/^160[23]$/" ); | |
$hits = array_map( $num_filter, $array ); | |
exit; | |
function make_filter ( $pattern ) { | |
$code = 'return preg_grep( "'.$pattern.'", $array );'; | |
$filter_func = create_function( '$array', $code ); | |
return $filter_func; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment