3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1($unset = false) { static $bar = 'test1'; echo $bar; if ($unset) { unset($bar); } } function test2($unset = false) { global $bar; if (!isset($bar)) { $bar = 'test2'; } echo $bar; if ($unset) { unset($bar); } } test1(); test1(); test1(true); test1(); test2(); test2(); test2(true); test2();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HAfKh
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'test1'
          1        DO_FCALL                                      0          
   30     2        INIT_FCALL                                               'test1'
          3        DO_FCALL                                      0          
   31     4        INIT_FCALL                                               'test1'
          5        SEND_VAL                                                 <true>
          6        DO_FCALL                                      0          
   32     7        INIT_FCALL                                               'test1'
          8        DO_FCALL                                      0          
   34     9        INIT_FCALL                                               'test2'
         10        DO_FCALL                                      0          
   35    11        INIT_FCALL                                               'test2'
         12        DO_FCALL                                      0          
   36    13        INIT_FCALL                                               'test2'
         14        SEND_VAL                                                 <true>
         15        DO_FCALL                                      0          
   37    16        INIT_FCALL                                               'test2'
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Function test1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/HAfKh
function name:  test1
number of ops:  6
compiled vars:  !0 = $unset, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      <false>
    4     1        BIND_STATIC                                              !1
    6     2        ECHO                                                     !1
    8     3      > JMPZ                                                     !0, ->5
    9     4    >   UNSET_CV                                                 !1
   11     5    > > RETURN                                                   null

End of function test1

Function test2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
Branch analysis from position: 6
filename:       /in/HAfKh
function name:  test2
number of ops:  10
compiled vars:  !0 = $unset, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV_INIT                                        !0      <false>
   14     1        BIND_GLOBAL                                              !1, 'bar'
   16     2        ISSET_ISEMPTY_CV                                 ~2      !1
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->6
   17     5    >   ASSIGN                                                   !1, 'test2'
   20     6    >   ECHO                                                     !1
   22     7      > JMPZ                                                     !0, ->9
   23     8    >   UNSET_CV                                                 !1
   25     9    > > RETURN                                                   null

End of function test2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.07 ms | 1400 KiB | 17 Q