3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function format_date($d) { $m = array(); preg_match('/(\d{4})[\.-\/](\d{2})[\.-\/](\d{2})/', $d, $m); if (count($m) == 4) { $d = "$m[2]/$m[3]/$m[1]"; } return $d; } print_r(format_date('2015-01-01')).'\n'; print_r(format_date('2015/01/02')).'\n'; print_r(format_date('2015.01-03')).'\n';
based on 69PNr
Output for 4.3.0 - 7.2.0
2015-01-0101/02/20152015.01-03