Created
September 27, 2016 13:14
-
-
Save jhyland87/c8202741f738a0e873ce840cf3775490 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 | |
| $to_iterate = get_defined_constants(); | |
| function do_filter($k) { | |
| if(count($argv)){ | |
| array_pop($argv); | |
| $pattern = '/^('.implode($argv,'|') .')_/i'; | |
| return preg_match( $pattern, $k ) > 0; | |
| } | |
| else { | |
| return TRUE; | |
| } | |
| } | |
| var_dump(array_filter($to_iterate, do_filter, ARRAY_FILTER_USE_KEY)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment