3v4l.org

run code in 300+ PHP versions simultaneously
<?php $john = array("goodie"); function test(){ global $john; for($i=0; $i<100; $i++) { array_push($john, "pro"); } print_r($john); } test(); // outputs correct array: array("goodie","pro","pro"....) /* then when again function is called */ test(); // output is NULL // with 100 errors in loop: // expects parameter 1 to be an array, NULL given...
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRKgO
function name:  (null)
number of ops:  6
compiled vars:  !0 = $john
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'test'
          2        DO_FCALL                                      0          
   18     3        INIT_FCALL                                               'test'
          4        DO_FCALL                                      0          
   20     5      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/dRKgO
function name:  test
number of ops:  14
compiled vars:  !0 = $john, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_GLOBAL                                              !0, 'john'
    7     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
    9     3    >   INIT_FCALL                                               'array_push'
          4        SEND_REF                                                 !0
          5        SEND_VAL                                                 'pro'
          6        DO_ICALL                                                 
    7     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, 100
          9      > JMPNZ                                                    ~5, ->3
   11    10    >   INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   12    13      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.92 ms | 1402 KiB | 19 Q