3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function bar() { $static = !(isset($this) && get_class($this) == __CLASS__); if ($static) { print "static"; } else { print "not static"; } } function test() { static::bar(); } } $foo = new Foo(); $foo->bar(); $foo->test(); Foo::bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4NInP
function name:  (null)
number of ops:  10
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0          
   21     5        INIT_METHOD_CALL                                         !0, 'test'
          6        DO_FCALL                                      0          
   23     7        INIT_STATIC_METHOD_CALL                                  'Foo', 'bar'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/4NInP
function name:  bar
number of ops:  13
compiled vars:  !0 = $static
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ISSET_ISEMPTY_THIS                               ~1      
          1      > JMPZ_EX                                          ~1      ~1, ->6
          2    >   FETCH_THIS                                       ~2      
          3        GET_CLASS                                        ~3      ~2
          4        IS_EQUAL                                         ~4      ~3, 'Foo'
          5        BOOL                                             ~1      ~4
          6    >   BOOL_NOT                                         ~5      ~1
          7        ASSIGN                                                   !0, ~5
    6     8      > JMPZ                                                     !0, ->11
    7     9    >   ECHO                                                     'static'
         10      > JMP                                                      ->12
   10    11    >   ECHO                                                     'not+static'
   12    12    > > RETURN                                                   null

End of function bar

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4NInP
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_STATIC_METHOD_CALL                                  'bar'
          1        DO_FCALL                                      0          
   16     2      > RETURN                                                   null

End of function test

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.46 ms | 1395 KiB | 13 Q