3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test1($unset = false) { static $bar = 0; $bar++; echo $bar; if ($unset) { // removes var from scope but value remains unset($bar); $bar = 10; } } test1(); test1(); test1(true); test1();
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/Xd6Bp
function name:  (null)
number of ops:  11
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  19     1        INIT_FCALL                                               'test1'
         2        DO_FCALL                                      0          
  20     3        INIT_FCALL                                               'test1'
         4        DO_FCALL                                      0          
  21     5        INIT_FCALL                                               'test1'
         6        SEND_VAL                                                 <true>
         7        DO_FCALL                                      0          
  22     8        INIT_FCALL                                               'test1'
         9        DO_FCALL                                      0          
        10      > RETURN                                                   1

Function test1:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
Jump found. Position 1 = -2
Branch analysis from position: 9
filename:       /in/Xd6Bp
function name:  test1
number of ops:  10
compiled vars:  !0 = $unset, !1 = $bar
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV_INIT                                        !0      <false>
   4     1        FETCH_W                      static              $2      'bar'
         2        ASSIGN_REF                                               !1, $2
   6     3        POST_INC                                         ~3      !1
         4        FREE                                                     ~3
   8     5        ECHO                                                     !1
  10     6      > JMPZ                                                     !0, ->9
  12     7    >   UNSET_VAR                                                !1
  14     8        ASSIGN                                                   !1, 10
  16     9    > > RETURN                                                   null

End of function test1

Generated using Vulcan Logic Dumper, using php 7.2.0