3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function cre() { static $foo; if (null === $foo) $foo = 0; return ++$foo; } public function bar() { static $foo; if (null === $foo) $foo = 0; return ++$foo; } } $foo = new Foo; echo $foo->cre(); echo $foo->bar(); echo $foo->cre(); echo $foo->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcRMq
function name:  (null)
number of ops:  16
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'cre'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
   27     6        INIT_METHOD_CALL                                         !0, 'bar'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   28     9        INIT_METHOD_CALL                                         !0, 'cre'
         10        DO_FCALL                                      0  $6      
         11        ECHO                                                     $6
   29    12        INIT_METHOD_CALL                                         !0, 'bar'
         13        DO_FCALL                                      0  $7      
         14        ECHO                                                     $7
         15      > RETURN                                                   1

Class Foo:
Function cre:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/HcRMq
function name:  cre
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    8     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->4
          3    >   ASSIGN                                                   !0, 0
   10     4    >   PRE_INC                                          ~3      !0
          5      > RETURN                                                   ~3
   11     6*     > RETURN                                                   null

End of function cre

Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/HcRMq
function name:  bar
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   BIND_STATIC                                              !0
   18     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->4
          3    >   ASSIGN                                                   !0, 0
   20     4    >   PRE_INC                                          ~3      !0
          5      > RETURN                                                   ~3
   21     6*     > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.35 ms | 1395 KiB | 13 Q