3v4l.org

run code in 300+ 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.0.0 - 8.0.3
CATCH FINALLY 2
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.26, 7.4.0 - 7.4.13
Warning: Division by zero in /in/6N4d9 on line 5 CATCH FINALLY 2