Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $head = function($a) {
- return array_shift($a);
- };
- $tail = function($a) {
- $first = array_shift($a);
- return $a;
- };
- $loop = function($a) use (&$loop, $head, $tail){
- if (!empty($head($a))){
- print($head($a));
- $loop($tail($a));
- }
- };
- $loop([1,2,3,4,5]);
Add Comment
Please, Sign In to add comment