3v4l.org

run code in 300+ PHP versions simultaneously
<?php # Globale Funktion function foo( $bar ) { return true; } class Foo { static function instance() { return new Foo(); } # Statische Methode static function bar( $buz ) { return true; } # Instanz Methode function buz( $bee ) { return true; } } # Error Handler setzen um Warnungen zu verkürzen set_error_handler( "err" ); function err( $errno, $errstr ) { echo "{WARNING} "; return true; } # Funktion zum Testen der Aufrufe function test( $method ) { try { eval ( $method ); echo "$method\n"; } catch ( Throwable $e ) { $class = get_class( $e ); echo "[$class] $method\n"; } } # Tests durchführen test('foo();'); test('Foo::bar();'); test('Foo::instance()->buz();'); test('ksort();');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1 - 8.4.2
[ArgumentCountError] foo(); [ArgumentCountError] Foo::bar(); [ArgumentCountError] Foo::instance()->buz(); [ArgumentCountError] ksort();
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
[ArgumentCountError] foo(); [ArgumentCountError] Foo::bar(); [ArgumentCountError] Foo::instance()->buz(); {WARNING} ksort();

preferences:
75.11 ms | 408 KiB | 5 Q