3v4l.org

run code in 300+ PHP versions simultaneously
<?php setlocale(LC_ALL, 'da-DK'); function convert_dates($text) { $date_regexp = '/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/'; preg_match_all($date_regexp, $text, $dates); $dates = $dates[0]; $new_dates = $dates; for($i=0;$i<count($new_dates);$i++) { $new_dates[$i] = strftime('%e. %B %Y', strtotime($new_dates[$i]))); } $text = str_replace($dates, $new_dates, $text); return $text; } echo convert_dates('2014-01-02 2013-02-03 2012-03-04');
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.23
Parse error: syntax error, unexpected ')' in /in/JsYZE on line 12
Process exited with code 255.

preferences:
179.37 ms | 1395 KiB | 60 Q