3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1990-09-15'; // $input = '15-09-1990'; // $input = '1990-49-85'; $a = DateTime::createFromFormat('Y-m-d', $input); if ($a === false) { echo "Invalid format\n"; } $lastError = DateTime::getLastErrors()['warnings'] ?? []; if (reset($lastError) === 'The parsed date was invalid') { echo "Invalid date\n"; }
Output for 8.2.28 - 8.2.29, 8.3.5 - 8.3.27, 8.4.5 - 8.4.15, 8.5.0
Output for 8.3.28
/bin/php-8.3.28: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.3.28)
Process exited with code 1.

preferences:
71.93 ms | 407 KiB | 5 Q