3v4l.org

run code in 300+ PHP versions simultaneously
<?php $formatter = new \IntlDateFormatter('it', 2, -1, "Europe/Rome", 1, "dd/MM/yyyy"); $formatter->setLenient(false); echo 'Pattern 1: dd/MM/yyyy'; echo "\n"; echo "27/05/1978: "; echo $formatter->parse('27/05/1978'); echo "\n"; echo "28/05/1978: "; echo $formatter->parse('28/05/1978'); echo "ERROR: "; echo intl_get_error_message(); echo "\n"; echo "29/05/1978: "; echo $formatter->parse('29/05/1978'); echo "\n\n"; echo 'Pattern 2: yyyy-MM-dd (Symfony\'s default)'; $formatter = new \IntlDateFormatter('it', 2, -1, "Europe/Rome", 1, "yyyy-MM-dd"); $formatter->setLenient(false); echo "\n"; echo "28/05/1978: "; echo $formatter->parse('1978-05-28'); echo "ERROR: "; echo intl_get_error_message();
Output for 5.6.0 - 5.6.25, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Pattern 1: dd/MM/yyyy 27/05/1978: 265071600 28/05/1978: ERROR: Date parsing failed: U_PARSE_ERROR 29/05/1978: 265240800 Pattern 2: yyyy-MM-dd (Symfony's default) 28/05/1978: ERROR: Date parsing failed: U_PARSE_ERROR
Output for 8.0.13
Fatal error: Uncaught Error: Class "IntlDateFormatter" not found in /in/NDnbm:3 Stack trace: #0 {main} thrown in /in/NDnbm on line 3
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Fatal error: Uncaught Error: Class 'IntlDateFormatter' not found in /in/NDnbm:3 Stack trace: #0 {main} thrown in /in/NDnbm on line 3
Process exited with code 255.

preferences:
142.57 ms | 408 KiB | 5 Q