3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected function __sleep ( ) {} protected function __wakeup() {} protected function __serialize ( ) { } protected function __unserialize ( array $data ) {} protected function __invoke() {} protected static function __set_state ( array $properties ) {} protected function __debugInfo ( ) {} protected function __call(string $name , array $arguments){} protected static function __callStatic(string $name , array $arguments) {} protected function __get( string $name ) {} protected function __set( string $name, $value) {} protected function __isset( string $name ) {} protected function __unset( string $name ) {} /*protected*/ function __construct() {} protected function __destruct() {} protected function __clone() {} //protected function __toString() {} } $foo = new Foo; // clone $foo; unset($foo);
based on 1Mt3i
Output for 8.0.0 - 8.0.3
Warning: The magic method Foo::__sleep() must have public visibility in /in/6NqUv on line 4 Warning: The magic method Foo::__wakeup() must have public visibility in /in/6NqUv on line 5 Warning: The magic method Foo::__serialize() must have public visibility in /in/6NqUv on line 6 Warning: The magic method Foo::__unserialize() must have public visibility in /in/6NqUv on line 7 Warning: The magic method Foo::__invoke() must have public visibility in /in/6NqUv on line 8 Warning: The magic method Foo::__set_state() must have public visibility in /in/6NqUv on line 9 Warning: The magic method Foo::__debugInfo() must have public visibility in /in/6NqUv on line 10 Warning: The magic method Foo::__call() must have public visibility in /in/6NqUv on line 11 Warning: The magic method Foo::__callStatic() must have public visibility in /in/6NqUv on line 12 Warning: The magic method Foo::__get() must have public visibility in /in/6NqUv on line 13 Warning: The magic method Foo::__set() must have public visibility in /in/6NqUv on line 14 Warning: The magic method Foo::__isset() must have public visibility in /in/6NqUv on line 15 Warning: The magic method Foo::__unset() must have public visibility in /in/6NqUv on line 16 Fatal error: Uncaught Error: Call to protected Foo::__destruct() from global scope in /in/6NqUv:26 Stack trace: #0 {main} thrown in /in/6NqUv on line 26
Process exited with code 255.
Output for 7.3.0 - 7.3.26, 7.4.0 - 7.4.14
Warning: The magic method __invoke() must have public visibility and cannot be static in /in/6NqUv on line 8 Warning: The magic method __debugInfo() must have public visibility and cannot be static in /in/6NqUv on line 10 Warning: The magic method __call() must have public visibility and cannot be static in /in/6NqUv on line 11 Warning: The magic method __callStatic() must have public visibility and be static in /in/6NqUv on line 12 Warning: The magic method __get() must have public visibility and cannot be static in /in/6NqUv on line 13 Warning: The magic method __set() must have public visibility and cannot be static in /in/6NqUv on line 14 Warning: The magic method __isset() must have public visibility and cannot be static in /in/6NqUv on line 15 Warning: The magic method __unset() must have public visibility and cannot be static in /in/6NqUv on line 16 Fatal error: Uncaught Error: Call to protected Foo::__destruct() from context '' in /in/6NqUv:26 Stack trace: #0 {main} thrown in /in/6NqUv on line 26
Process exited with code 255.