Guest User

Untitled

a guest
May 21st, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #!/usr/bin/env php
  2. <?php
  3.  
  4. # for PHP 5.3 use "Closure"
  5. $strtoupper = function($s) { return strtoupper($s); };
  6.  
  7. $fruits = array('apple', 'orange', 'cherry');
  8. $stars = array('sun', 'moon', 'earch');
  9.  
  10. echo implode('-', array_map($strtoupper, $fruits)) . "\r\n"; // APPLE-ORANGE-CHERRY
  11. echo implode('-', array_map($strtoupper, $stars)) . "\r\n"; // SUN-MOON-EARCH
Add Comment
Please, Sign In to add comment