Created
December 26, 2010 08:03
-
-
Save shameerc/755295 to your computer and use it in GitHub Desktop.
Array filter function using lambda function
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 | |
| $time = array('morning', 'noon'); | |
| array_filter($time, function($a){ | |
| if($a=='noon') | |
| echo 'Its lunch time'; | |
| else | |
| echo "Its time for breakfast"; | |
| } | |
| ); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment