3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = new \StdClass; $bar = new \StdClass; $foo->bar = $bar; $bar->foo = $foo; $array = array('foo' => $foo, 'bar' => $bar); $hash = array(); rwalk($array); function rwalk($array) { if (is_array($array)) { foreach ($array as $key => $value) { if (is_object($value)) { $objHash = spl_object_hash($value); $value = (array) $value; } if (is_array($value) && !in_array($objHash, $hash)) { $hash[] = $objHash; rwalk($value); } } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CkXC4
function name:  (null)
number of ops:  18
compiled vars:  !0 = $foo, !1 = $bar, !2 = $array, !3 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $4      'StdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    3     3        NEW                                              $7      'StdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $7
    4     6        ASSIGN_OBJ                                               !0, 'bar'
          7        OP_DATA                                                  !1
    5     8        ASSIGN_OBJ                                               !1, 'foo'
          9        OP_DATA                                                  !0
    6    10        INIT_ARRAY                                       ~12     !0, 'foo'
         11        ADD_ARRAY_ELEMENT                                ~12     !1, 'bar'
         12        ASSIGN                                                   !2, ~12
    8    13        ASSIGN                                                   !3, <array>
   10    14        INIT_FCALL_BY_NAME                                       'rwalk'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0          
   26    17      > RETURN                                                   1

Function rwalk:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 30
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 29
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 29
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 28
Branch analysis from position: 22
Branch analysis from position: 14
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 30
filename:       /in/CkXC4
function name:  rwalk
number of ops:  31
compiled vars:  !0 = $array, !1 = $value, !2 = $key, !3 = $objHash, !4 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~5, ->30
   14     3    > > FE_RESET_R                                       $6      !0, ->29
          4    > > FE_FETCH_R                                       ~7      $6, !1, ->29
          5    >   ASSIGN                                                   !2, ~7
   15     6        TYPE_CHECK                                  256          !1
          7      > JMPZ                                                     ~9, ->14
   16     8    >   INIT_FCALL                                               'spl_object_hash'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !3, $10
   17    12        CAST                                          7  ~12     !1
         13        ASSIGN                                                   !1, ~12
   20    14    >   TYPE_CHECK                                  128  ~14     !1
         15      > JMPZ_EX                                          ~14     ~14, ->22
         16    >   INIT_FCALL                                               'in_array'
         17        SEND_VAR                                                 !3
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                         $15     
         20        BOOL_NOT                                         ~16     $15
         21        BOOL                                             ~14     ~16
         22    > > JMPZ                                                     ~14, ->28
   21    23    >   ASSIGN_DIM                                               !4
         24        OP_DATA                                                  !3
   22    25        INIT_FCALL_BY_NAME                                       'rwalk'
         26        SEND_VAR_EX                                              !1
         27        DO_FCALL                                      0          
   14    28    > > JMP                                                      ->4
         29    >   FE_FREE                                                  $6
   26    30    > > RETURN                                                   null

End of function rwalk

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.61 ms | 1400 KiB | 17 Q