3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(&$error) { $response = (object)array(); $response->code = 200; $fail = function($err, $code=400) use (&$error, $response) { $error[] = $err; $response->code = $code; 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/dceRZ
function name:  (null)
number of ops:  12
compiled vars:  !0 = $error, !1 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'test'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   19     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   20     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/dceRZ
function name:  test
number of ops:  14
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_OBJ                                               !1, 'code'
          4        OP_DATA                                                  200
    7     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FdceRZ%3A7%240'
          6        BIND_LEXICAL                                             ~6, !0
          7        BIND_LEXICAL                                             ~6, !1
          8        ASSIGN                                                   !2, ~6
   13     9        INIT_DYNAMIC_CALL                                        !2
         10        SEND_VAL_EX                                              'invalid+derp'
         11        DO_FCALL                                      0  $8      
         12      > RETURN                                                   $8
   14    13*     > RETURN                                                   null

End of function test

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.74 ms | 1403 KiB | 16 Q