3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wrap( $arr){ test( $arr); } function test( $arr){ $refs = array(); $f = function( $arr) use( &$refs, &$f) { $refs[] = $arr; foreach( $arr as $v) { if( in_array( $v, $refs)) { print 'ref, '; } else { if( is_array( $v)) { $f( $v); } else { print $v . ', '; } } } }; $f( $arr); } $array = array(1, 2, 3, array(1, 2, 3)); $array[4][4][2][6][1] = array(1,2,3=>&$array); wrap( $array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ApH1G
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   ASSIGN                                                   !0, <array>
   27     1        INIT_ARRAY                                       ~7      1
          2        ADD_ARRAY_ELEMENT                                ~7      2
          3        ADD_ARRAY_ELEMENT                                ~7      !0, 3
          4        FETCH_DIM_W                                      $2      !0, 4
          5        FETCH_DIM_W                                      $3      $2, 4
          6        FETCH_DIM_W                                      $4      $3, 2
          7        FETCH_DIM_W                                      $5      $4, 6
          8        ASSIGN_DIM                                               $5, 1
          9        OP_DATA                                                  ~7
   28    10        INIT_FCALL                                               'wrap'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function wrap:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ApH1G
function name:  wrap
number of ops:  5
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL_BY_NAME                                       'test'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    4     4      > RETURN                                                   null

End of function wrap

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ApH1G
function name:  test
number of ops:  10
compiled vars:  !0 = $arr, !1 = $refs, !2 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, <array>
    9     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FApH1G%3A9%240'
          3        BIND_LEXICAL                                             ~4, !1
          4        BIND_LEXICAL                                             ~4, !2
          5        ASSIGN                                                   !2, ~4
   23     6        INIT_DYNAMIC_CALL                                        !2
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   24     9      > RETURN                                                   null

End of function test

Function %00%7Bclosure%7D%2Fin%2FApH1G%3A9%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/ApH1G
function name:  {closure}
number of ops:  25
compiled vars:  !0 = $arr, !1 = $refs, !2 = $f, !3 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   10     3        ASSIGN_DIM                                               !1
          4        OP_DATA                                                  !0
   11     5      > FE_RESET_R                                       $5      !0, ->23
          6    > > FE_FETCH_R                                               $5, !3, ->23
   12     7    >   INIT_FCALL                                               'in_array'
          8        SEND_VAR                                                 !3
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11      > JMPZ                                                     $6, ->14
   13    12    >   ECHO                                                     'ref%2C+'
         13      > JMP                                                      ->22
   15    14    >   TYPE_CHECK                                  128          !3
         15      > JMPZ                                                     ~7, ->20
   16    16    >   INIT_DYNAMIC_CALL                                        !2
         17        SEND_VAR_EX                                              !3
         18        DO_FCALL                                      0          
         19      > JMP                                                      ->22
   18    20    >   CONCAT                                           ~9      !3, '%2C+'
         21        ECHO                                                     ~9
   11    22    > > JMP                                                      ->6
         23    >   FE_FREE                                                  $5
   22    24      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FApH1G%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.91 ms | 1403 KiB | 16 Q