3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($tring, $string2){ return $tring . $string2; } $obj = new stdClass(); $obj->bean = array(); $das = array('function' => 'teste'); $obj->bean = $das; var_dump($obj); echo $obj->bean->das['function']("Lucas","Oliveira");
Output for 8.3.0 - 8.3.4, 8.3.6
object(stdClass)#1 (1) { ["bean"]=> array(1) { ["function"]=> string(5) "teste" } } Warning: Attempt to read property "das" on array in /in/1icha on line 17 Warning: Trying to access array offset on null in /in/1icha on line 17 Fatal error: Uncaught Error: Value of type null is not callable in /in/1icha:17 Stack trace: #0 {main} thrown in /in/1icha on line 17
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 object(stdClass)#1 (1) { ["bean"]=> array(1) { ["function"]=> string(5) "teste" } } Warning: Attempt to read property "das" on array in /in/1icha on line 17 Warning: Trying to access array offset on null in /in/1icha on line 17 Fatal error: Uncaught Error: Value of type null is not callable in /in/1icha:17 Stack trace: #0 {main} thrown in /in/1icha on line 17
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
object(stdClass)#1 (1) { ["bean"]=> array(1) { ["function"]=> string(5) "teste" } } Warning: Attempt to read property "das" on array in /in/1icha on line 17 Warning: Trying to access array offset on value of type null in /in/1icha on line 17 Fatal error: Uncaught Error: Value of type null is not callable in /in/1icha:17 Stack trace: #0 {main} thrown in /in/1icha on line 17
Process exited with code 255.
Output for 7.4.0 - 7.4.33
object(stdClass)#1 (1) { ["bean"]=> array(1) { ["function"]=> string(5) "teste" } } Notice: Trying to get property 'das' of non-object in /in/1icha on line 17 Notice: Trying to access array offset on value of type null in /in/1icha on line 17 Fatal error: Uncaught Error: Function name must be a string in /in/1icha:17 Stack trace: #0 {main} thrown in /in/1icha on line 17
Process exited with code 255.
Output for 7.3.32 - 7.3.33
object(stdClass)#1 (1) { ["bean"]=> array(1) { ["function"]=> string(5) "teste" } } Fatal error: Uncaught Error: Function name must be a string in /in/1icha:17 Stack trace: #0 {main} thrown in /in/1icha on line 17
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
object(stdClass)#1 (1) { ["bean"]=> array(1) { ["function"]=> string(5) "teste" } } Notice: Trying to get property 'das' of non-object in /in/1icha on line 17 Fatal error: Uncaught Error: Function name must be a string in /in/1icha:17 Stack trace: #0 {main} thrown in /in/1icha on line 17
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
object(stdClass)#1 (1) { ["bean"]=> array(1) { ["function"]=> string(5) "teste" } } Notice: Trying to get property of non-object in /in/1icha on line 17 Fatal error: Uncaught Error: Function name must be a string in /in/1icha:17 Stack trace: #0 {main} thrown in /in/1icha on line 17
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.21
object(stdClass)#1 (1) { ["bean"]=> array(1) { ["function"]=> string(5) "teste" } } Notice: Trying to get property of non-object in /in/1icha on line 17 Fatal error: Function name must be a string in /in/1icha on line 17
Process exited with code 255.

preferences:
161.76 ms | 402 KiB | 227 Q