arijulianto

Convert Date Format Each Item in Array

Dec 16th, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.27 KB | None | 0 0
  1. <?php
  2. // sampel input array
  3. $data = array("2013-12-20","2013-12-21","2013-12-22");
  4.  
  5. // fungsi untuk format tanggal
  6. function toDMY(&$input){
  7.   $input = date("d/m/Y", strtotime($input));
  8.   return $input;
  9. }
  10.  
  11. array_walk($data,'toDMY');
  12.  
  13. // test output
  14. print_r($data);
  15. ?>
Advertisement
Add Comment
Please, Sign In to add comment