3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { static function foo() { echo 'OK', PHP_EOL; } } T::foo(); fb_intercept('T::foo', function() { echo 'NOT '; }); T::foo();
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Calling static trait method T::foo is deprecated, it should only be called on a class using the trait in /in/h1hLS on line 11 OK Fatal error: Uncaught Error: Call to undefined function fb_intercept() in /in/h1hLS:13 Stack trace: #0 {main} thrown in /in/h1hLS on line 13
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
OK Fatal error: Uncaught Error: Call to undefined function fb_intercept() in /in/h1hLS:13 Stack trace: #0 {main} thrown in /in/h1hLS on line 13
Process exited with code 255.
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
OK Fatal error: Call to undefined function fb_intercept() in /in/h1hLS on line 13
Process exited with code 255.

preferences:
218.71 ms | 402 KiB | 257 Q