3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Weird { public static function test() { $static = !(isset($this) && get_class($this) == __CLASS__); echo ($static ? "static" : "instance") . "\n"; } } Weird::test(); $w = new Weird; $w->test(); // no the same
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/opRbl
function name:  (null)
number of ops:  8
compiled vars:  !0 = $w
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_STATIC_METHOD_CALL                                  'Weird', 'test'
          1        DO_FCALL                                      0          
   11     2        NEW                                              $2      'Weird'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   12     5        INIT_METHOD_CALL                                         !0, 'test'
          6        DO_FCALL                                      0          
   13     7      > RETURN                                                   1

Class Weird:
Function test:
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/opRbl
function name:  test
number of ops:  15
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, 'Weird'
          5        BOOL                                             ~1      ~4
          6    >   BOOL_NOT                                         ~5      ~1
          7        ASSIGN                                                   !0, ~5
    6     8      > JMPZ                                                     !0, ->11
          9    >   QM_ASSIGN                                        ~7      'static'
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~7      'instance'
         12    >   CONCAT                                           ~8      ~7, '%0A'
         13        ECHO                                                     ~8
    7    14      > RETURN                                                   null

End of function test

End of class Weird.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.4 ms | 1395 KiB | 13 Q