Guest User

Untitled

a guest
Mar 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. <?php
  2.  
  3. $head = function($a) {
  4. return array_shift($a);
  5. };
  6.  
  7. $tail = function($a) {
  8. $first = array_shift($a);
  9. return $a;
  10. };
  11.  
  12.  
  13. $loop = function($a) use (&$loop, $head, $tail){
  14. if (!empty($head($a))){
  15. print($head($a));
  16. $loop($tail($a));
  17. }
  18. };
  19.  
  20. $loop([1,2,3,4,5]);
Add Comment
Please, Sign In to add comment