3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('a' => 'aa'); $x = new ArrayObject; $x[null] = array(); $x[null]['bar'] = 'foo'; ### this causes it # ---------------------------------------- function f($k) { $f = array('f' => 'ff'); return $f[$k]; } echo "ArrayObject dump:\n"; var_dump($x); echo "Non-existing array elements (current scope, function scope)\n"; var_dump($a['b'], f('b')); echo "Define a new variable: \$s='hohohoooo'\n"; $s = 'hohohoooo'; var_dump($a['b'], f('b')); echo "Define a new variable: \$n=1\n"; $n = 1; var_dump($a['b'], f('b'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p0fnK
function name:  (null)
number of ops:  43
compiled vars:  !0 = $a, !1 = $x, !2 = $s, !3 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        NEW                                              $5      'ArrayObject'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
    6     4        ASSIGN_DIM                                               !1, null
          5        OP_DATA                                                  <array>
    7     6        FETCH_DIM_W                                      $9      !1, null
          7        ASSIGN_DIM                                               $9, 'bar'
          8        OP_DATA                                                  'foo'
   16     9        ECHO                                                     'ArrayObject+dump%3A%0A'
   17    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   19    13        ECHO                                                     'Non-existing+array+elements+%28current+scope%2C+function+scope%29%0A'
   20    14        INIT_FCALL                                               'var_dump'
         15        FETCH_DIM_R                                      ~12     !0, 'b'
         16        SEND_VAL                                                 ~12
         17        INIT_FCALL                                               'f'
         18        SEND_VAL                                                 'b'
         19        DO_FCALL                                      0  $13     
         20        SEND_VAR                                                 $13
         21        DO_ICALL                                                 
   22    22        ECHO                                                     'Define+a+new+variable%3A+%24s%3D%27hohohoooo%27%0A'
   23    23        ASSIGN                                                   !2, 'hohohoooo'
   24    24        INIT_FCALL                                               'var_dump'
         25        FETCH_DIM_R                                      ~16     !0, 'b'
         26        SEND_VAL                                                 ~16
         27        INIT_FCALL                                               'f'
         28        SEND_VAL                                                 'b'
         29        DO_FCALL                                      0  $17     
         30        SEND_VAR                                                 $17
         31        DO_ICALL                                                 
   26    32        ECHO                                                     'Define+a+new+variable%3A+%24n%3D1%0A'
   27    33        ASSIGN                                                   !3, 1
   28    34        INIT_FCALL                                               'var_dump'
         35        FETCH_DIM_R                                      ~20     !0, 'b'
         36        SEND_VAL                                                 ~20
         37        INIT_FCALL                                               'f'
         38        SEND_VAL                                                 'b'
         39        DO_FCALL                                      0  $21     
         40        SEND_VAR                                                 $21
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p0fnK
function name:  f
number of ops:  5
compiled vars:  !0 = $k, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN                                                   !1, <array>
   13     2        FETCH_DIM_R                                      ~3      !1, !0
          3      > RETURN                                                   ~3
   14     4*     > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.22 ms | 1407 KiB | 18 Q