3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach (['en_US', 'ru_RU', 'es_ES', 'fa_IR'] as $locale) { $dateFormat = (new \IntlDateFormatter( $locale, \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE ))->getPattern(); $formatWithLongYear = preg_replace( '/(?<!y)yy(?!y)/', 'Y', $dateFormat ) $formatter = new \IntlDateFormatter( $locale, \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, null, $formatWithLongYear ); echo $formatter->format(1455111783), PHP_EOL; }
Output for 5.5.24 - 5.5.32, 5.6.8 - 5.6.18, 7.0.0 - 7.0.3
Parse error: syntax error, unexpected '$formatter' (T_VARIABLE) in /in/SAJ3T on line 16
Process exited with code 255.

preferences:
174.74 ms | 1387 KiB | 31 Q