3v4l.org

run code in 500+ PHP versions simultaneously
<?php $b = 'b_global'; function foo(bool $shadow) { $a = 'a_local'; $b = 'b_local'; var_dump($a, $b); if ( $shadow ) { static $a; global $b; } var_dump($a, $b); } foo(true); echo "----\n"; foo(false);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fK9VJ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'b_global'
   18     1        INIT_FCALL                                                   'foo'
          2        SEND_VAL                                                     <true>
          3        DO_FCALL                                          0          
   19     4        ECHO                                                         '----%0A'
   20     5        INIT_FCALL                                                   'foo'
          6        SEND_VAL                                                     <false>
          7        DO_FCALL                                          0          
          8      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/fK9VJ
function name:  foo
number of ops:  15
compiled vars:  !0 = $shadow, !1 = $a, !2 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    6     1        ASSIGN                                                       !1, 'a_local'
    7     2        ASSIGN                                                       !2, 'b_local'
    8     3        INIT_FCALL                                                   'var_dump'
          4        SEND_VAR                                                     !1
          5        SEND_VAR                                                     !2
          6        DO_ICALL                                                     
   10     7      > JMPZ                                                         !0, ->10
   11     8    >   BIND_STATIC                                                  !1
   12     9        BIND_GLOBAL                                                  !2, 'b'
   15    10    >   INIT_FCALL                                                   'var_dump'
         11        SEND_VAR                                                     !1
         12        SEND_VAR                                                     !2
         13        DO_ICALL                                                     
   16    14      > RETURN                                                       null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.61 ms | 1183 KiB | 16 Q