3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(&$error) { $response = (object)array(); $error[] = 'test'; $fail = function($err) { $error[] = $err; return $response; }; return $fail('invalid derp'); } $error = array(); $response = test($error); var_dump($error); var_dump($response);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u6RU2
function name:  (null)
number of ops:  12
compiled vars:  !0 = $error, !1 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'test'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   18     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   19     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u6RU2
function name:  test
number of ops:  12
compiled vars:  !0 = $error, !1 = $response, !2 = $fail
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        CAST                                          8  ~3      <array>
          2        ASSIGN                                                   !1, ~3
    5     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  'test'
    7     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fu6RU2%3A7%240'
          6        ASSIGN                                                   !2, ~6
   12     7        INIT_DYNAMIC_CALL                                        !2
          8        SEND_VAL_EX                                              'invalid+derp'
          9        DO_FCALL                                      0  $8      
         10      > RETURN                                                   $8
   13    11*     > RETURN                                                   null

End of function test

Function %00%7Bclosure%7D%2Fin%2Fu6RU2%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u6RU2
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $err, !1 = $error, !2 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_DIM                                               !1
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   !2
   10     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fu6RU2%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.45 ms | 1399 KiB | 16 Q