3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 7.1.0 - 7.3.1
[ArgumentCountError] foo(); [ArgumentCountError] Foo::bar(); [ArgumentCountError] Foo::instance()->buz(); {WARNING} ksort();
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0
{WARNING} foo(); {WARNING} Foo::bar(); {WARNING} Foo::instance()->buz(); {WARNING} ksort();