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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 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:
199.89 ms | 402 KiB | 184 Q