3v4l.org

run code in 300+ PHP versions simultaneously
<?php function keys_with_reference(array $array) { $clone = $array; $testObject = new \stdClass; $keys_with_reference = array(); foreach ($array as $k => $v) { $clone[$k] = $testObject; if ($array[$k] === $testObject) { $array[$k] = $v; $keys_with_reference[$k] = TRUE; } } return $keys_with_reference; } function use_reference(&$v) { static $static; $static = $v; } $x = array( 'left' => array(), 'right' => array(), ); print_r(keys_with_reference($x)); use_reference($x['left']); print_r(keys_with_reference($x)); $left = &$x['left']; print_r(keys_with_reference($x));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PiliK
function name:  (null)
number of ops:  26
compiled vars:  !0 = $x, !1 = $left
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ASSIGN                                                   !0, <array>
   27     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'keys_with_reference'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        SEND_VAR                                                 $3
          6        DO_ICALL                                                 
   29     7        INIT_FCALL                                               'use_reference'
          8        FETCH_DIM_W                                      $5      !0, 'left'
          9        SEND_REF                                                 $5
         10        DO_FCALL                                      0          
   31    11        INIT_FCALL                                               'print_r'
         12        INIT_FCALL                                               'keys_with_reference'
         13        SEND_VAR                                                 !0
         14        DO_FCALL                                      0  $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                                 
   33    17        FETCH_DIM_W                                      $9      !0, 'left'
         18        ASSIGN_REF                                               !1, $9
   35    19        INIT_FCALL                                               'print_r'
         20        INIT_FCALL                                               'keys_with_reference'
         21        SEND_VAR                                                 !0
         22        DO_FCALL                                      0  $11     
         23        SEND_VAR                                                 $11
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Function keys_with_reference:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/PiliK
function name:  keys_with_reference
number of ops:  22
compiled vars:  !0 = $array, !1 = $clone, !2 = $testObject, !3 = $keys_with_reference, !4 = $v, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, !0
    5     2        NEW                                              $7      'stdClass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $7
    6     5        ASSIGN                                                   !3, <array>
    7     6      > FE_RESET_R                                       $11     !0, ->19
          7    > > FE_FETCH_R                                       ~12     $11, !4, ->19
          8    >   ASSIGN                                                   !5, ~12
    8     9        ASSIGN_DIM                                               !1, !5
         10        OP_DATA                                                  !2
    9    11        FETCH_DIM_R                                      ~15     !0, !5
         12        IS_IDENTICAL                                             !2, ~15
         13      > JMPZ                                                     ~16, ->18
   10    14    >   ASSIGN_DIM                                               !0, !5
         15        OP_DATA                                                  !4
   11    16        ASSIGN_DIM                                               !3, !5
         17        OP_DATA                                                  <true>
    7    18    > > JMP                                                      ->7
         19    >   FE_FREE                                                  $11
   14    20      > RETURN                                                   !3
   15    21*     > RETURN                                                   null

End of function keys_with_reference

Function use_reference:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PiliK
function name:  use_reference
number of ops:  4
compiled vars:  !0 = $v, !1 = $static
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        BIND_STATIC                                              !1
   19     2        ASSIGN                                                   !1, !0
   20     3      > RETURN                                                   null

End of function use_reference

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.28 ms | 1407 KiB | 19 Q