3v4l.org

run code in 300+ PHP versions simultaneously
<?php $calledby = debug_backtrace(); print_r($calledby); // does not work $caller = (strlen($calledby[1]['class'])) ? $calledby[1]['class'] : $calledby[0]['class']; // works and does does not segfault if (strlen($calledby[1]['class'])) $caller = $calledby[1]['class']; else $caller = $calledby[0]['class']; # arguments are required if (!func_num_args()) { return; } # fill variables with argument contents if exists $variables = (func_num_args() == 0) ? NULL : (is_array(func_get_arg(0)) ? func_get_arg(0) : NULL);
Output for 8.3.0 - 8.3.4, 8.3.6
Array ( ) Warning: Undefined array key 1 in /in/vVmrH on line 4 Warning: Trying to access array offset on null in /in/vVmrH on line 4 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/vVmrH on line 4 Warning: Undefined array key 0 in /in/vVmrH on line 4 Warning: Trying to access array offset on null in /in/vVmrH on line 4 Warning: Undefined array key 1 in /in/vVmrH on line 6 Warning: Trying to access array offset on null in /in/vVmrH on line 6 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/vVmrH on line 6 Warning: Undefined array key 0 in /in/vVmrH on line 7 Warning: Trying to access array offset on null in /in/vVmrH on line 7 Fatal error: Uncaught Error: func_num_args() must be called from a function context in /in/vVmrH:10 Stack trace: #0 /in/vVmrH(10): func_num_args() #1 {main} thrown in /in/vVmrH on line 10
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 Array ( ) Warning: Undefined array key 1 in /in/vVmrH on line 4 Warning: Trying to access array offset on null in /in/vVmrH on line 4 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/vVmrH on line 4 Warning: Undefined array key 0 in /in/vVmrH on line 4 Warning: Trying to access array offset on null in /in/vVmrH on line 4 Warning: Undefined array key 1 in /in/vVmrH on line 6 Warning: Trying to access array offset on null in /in/vVmrH on line 6 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/vVmrH on line 6 Warning: Undefined array key 0 in /in/vVmrH on line 7 Warning: Trying to access array offset on null in /in/vVmrH on line 7 Fatal error: Uncaught Error: func_num_args() must be called from a function context in /in/vVmrH:10 Stack trace: #0 /in/vVmrH(10): func_num_args() #1 {main} thrown in /in/vVmrH on line 10
Process exited with code 255.
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.18
Array ( ) Warning: Undefined array key 1 in /in/vVmrH on line 4 Warning: Trying to access array offset on value of type null in /in/vVmrH on line 4 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/vVmrH on line 4 Warning: Undefined array key 0 in /in/vVmrH on line 4 Warning: Trying to access array offset on value of type null in /in/vVmrH on line 4 Warning: Undefined array key 1 in /in/vVmrH on line 6 Warning: Trying to access array offset on value of type null in /in/vVmrH on line 6 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/vVmrH on line 6 Warning: Undefined array key 0 in /in/vVmrH on line 7 Warning: Trying to access array offset on value of type null in /in/vVmrH on line 7 Fatal error: Uncaught Error: func_num_args() must be called from a function context in /in/vVmrH:10 Stack trace: #0 /in/vVmrH(10): func_num_args() #1 {main} thrown in /in/vVmrH on line 10
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Array ( ) Warning: Undefined array key 1 in /in/vVmrH on line 4 Warning: Trying to access array offset on value of type null in /in/vVmrH on line 4 Warning: Undefined array key 0 in /in/vVmrH on line 4 Warning: Trying to access array offset on value of type null in /in/vVmrH on line 4 Warning: Undefined array key 1 in /in/vVmrH on line 6 Warning: Trying to access array offset on value of type null in /in/vVmrH on line 6 Warning: Undefined array key 0 in /in/vVmrH on line 7 Warning: Trying to access array offset on value of type null in /in/vVmrH on line 7 Fatal error: Uncaught Error: func_num_args() must be called from a function context in /in/vVmrH:10 Stack trace: #0 /in/vVmrH(10): func_num_args() #1 {main} thrown in /in/vVmrH on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Array ( ) Notice: Undefined offset: 1 in /in/vVmrH on line 4 Notice: Trying to access array offset on value of type null in /in/vVmrH on line 4 Notice: Undefined offset: 0 in /in/vVmrH on line 4 Notice: Trying to access array offset on value of type null in /in/vVmrH on line 4 Notice: Undefined offset: 1 in /in/vVmrH on line 6 Notice: Trying to access array offset on value of type null in /in/vVmrH on line 6 Notice: Undefined offset: 0 in /in/vVmrH on line 7 Notice: Trying to access array offset on value of type null in /in/vVmrH on line 7 Warning: func_num_args(): Called from the global scope - no function context in /in/vVmrH on line 10 Warning: func_num_args(): Called from the global scope - no function context in /in/vVmrH on line 12 Warning: func_get_arg(): Called from the global scope - no function context in /in/vVmrH on line 12
Output for 7.3.32 - 7.3.33
Array ( ) Warning: func_num_args(): Called from the global scope - no function context in /in/vVmrH on line 10 Warning: func_num_args(): Called from the global scope - no function context in /in/vVmrH on line 12 Warning: func_get_arg(): Called from the global scope - no function context in /in/vVmrH on line 12
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
Array ( ) Notice: Undefined offset: 1 in /in/vVmrH on line 4 Notice: Undefined offset: 0 in /in/vVmrH on line 4 Notice: Undefined offset: 1 in /in/vVmrH on line 6 Notice: Undefined offset: 0 in /in/vVmrH on line 7 Warning: func_num_args(): Called from the global scope - no function context in /in/vVmrH on line 10 Warning: func_num_args(): Called from the global scope - no function context in /in/vVmrH on line 12 Warning: func_get_arg(): Called from the global scope - no function context in /in/vVmrH on line 12
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Array ( ) Notice: Undefined offset: 1 in /in/vVmrH on line 4 Notice: Undefined offset: 0 in /in/vVmrH on line 4 Notice: Undefined offset: 1 in /in/vVmrH on line 6 Notice: Undefined offset: 0 in /in/vVmrH on line 7 Warning: func_num_args(): Called from the global scope - no function context in /in/vVmrH on line 10 Warning: func_num_args(): Called from the global scope - no function context in /in/vVmrH on line 12 Warning: func_get_arg(): Called from the global scope - no function context in /in/vVmrH on line 12
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Array ( ) Notice: Undefined offset: 1 in /in/vVmrH on line 4 Notice: Undefined offset: 0 in /in/vVmrH on line 4 Notice: Undefined offset: 1 in /in/vVmrH on line 6 Notice: Undefined offset: 0 in /in/vVmrH on line 7 Fatal error: func_num_args(): Can't be used as a function parameter in /in/vVmrH on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Array ( ) Notice: Undefined offset: 1 in /in/vVmrH on line 4 Notice: Undefined offset: 0 in /in/vVmrH on line 4 Notice: Undefined offset: 1 in /in/vVmrH on line 6 Notice: Undefined offset: 0 in /in/vVmrH on line 7 Fatal error: func_num_args(): Can't be used as a function parameter in /in/vVmrH on line 10

preferences:
324.04 ms | 402 KiB | 459 Q