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);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: The magic method Foo::__sleep() must have public visibility in /in/1Mt3i on line 4 Warning: The magic method Foo::__wakeup() must have public visibility in /in/1Mt3i on line 5 Warning: The magic method Foo::__serialize() must have public visibility in /in/1Mt3i on line 6 Warning: The magic method Foo::__unserialize() must have public visibility in /in/1Mt3i on line 7 Warning: The magic method Foo::__invoke() must have public visibility in /in/1Mt3i on line 8 Warning: The magic method Foo::__set_state() must have public visibility in /in/1Mt3i on line 9 Warning: The magic method Foo::__debugInfo() must have public visibility in /in/1Mt3i on line 10 Warning: The magic method Foo::__call() must have public visibility in /in/1Mt3i on line 11 Warning: The magic method Foo::__callStatic() must have public visibility in /in/1Mt3i on line 12 Warning: The magic method Foo::__get() must have public visibility in /in/1Mt3i on line 13 Warning: The magic method Foo::__set() must have public visibility in /in/1Mt3i on line 14 Warning: The magic method Foo::__isset() must have public visibility in /in/1Mt3i on line 15 Warning: The magic method Foo::__unset() must have public visibility in /in/1Mt3i on line 16 Fatal error: Uncaught Error: Call to protected Foo::__clone() from global scope in /in/1Mt3i:25 Stack trace: #0 {main} thrown in /in/1Mt3i on line 25 Warning: Call to protected Foo::__destruct() from global scope during shutdown ignored in Unknown on line 0
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: The magic method __invoke() must have public visibility and cannot be static in /in/1Mt3i on line 8 Warning: The magic method __debugInfo() must have public visibility and cannot be static in /in/1Mt3i on line 10 Warning: The magic method __call() must have public visibility and cannot be static in /in/1Mt3i on line 11 Warning: The magic method __callStatic() must have public visibility and be static in /in/1Mt3i on line 12 Warning: The magic method __get() must have public visibility and cannot be static in /in/1Mt3i on line 13 Warning: The magic method __set() must have public visibility and cannot be static in /in/1Mt3i on line 14 Warning: The magic method __isset() must have public visibility and cannot be static in /in/1Mt3i on line 15 Warning: The magic method __unset() must have public visibility and cannot be static in /in/1Mt3i on line 16 Fatal error: Uncaught Error: Call to protected Foo::__clone() from context '' in /in/1Mt3i:25 Stack trace: #0 {main} thrown in /in/1Mt3i on line 25
Process exited with code 255.

preferences:
148.2 ms | 402 KiB | 146 Q