3v4l.org

run code in 500+ PHP versions simultaneously
<?php error_reporting(E_ALL|E_STRICT); function do_test(): int { try { 1/0; // a warning in php 7 - reported as documented nonexistent_function(); // a fatal error - not reported - program continues 1%0; // a fatal error return 0; } catch (Throwable $t) { printf("CATCH\n"); return 1; } finally { printf("FINALLY\n"); return 2; } return 3; } printf("%d\n", do_test());
Output for 8.5.0 - 8.5.3
Deprecated: Constant E_STRICT is deprecated since 8.4, the error level was removed in /in/6N4d9 on line 2 CATCH FINALLY 2
Output for 8.4.1 - 8.4.18
Deprecated: Constant E_STRICT is deprecated in /in/6N4d9 on line 2 CATCH FINALLY 2
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30
CATCH FINALLY 2
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Division by zero in /in/6N4d9 on line 5 CATCH FINALLY 2

preferences:
116 ms | 1504 KiB | 4 Q