3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function foo() { if (isset($this)) { echo '$this is defined ('; echo get_class($this); echo ")\n"; } else { echo "\$this is not defined.\n"; } } } // this will print '$this is defined (A)' $a = new A(); $a->foo(); // what does this print? A::foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VW0bc
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   18     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
   21     5        INIT_STATIC_METHOD_CALL                                  'A', 'foo'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VW0bc
function name:  foo
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ISSET_ISEMPTY_THIS                               ~0      
          1      > JMPZ                                                     ~0, ->8
    7     2    >   ECHO                                                     '%24this+is+defined+%28'
    8     3        FETCH_THIS                                       ~1      
          4        GET_CLASS                                        ~2      ~1
          5        ECHO                                                     ~2
    9     6        ECHO                                                     '%29%0A'
          7      > JMP                                                      ->9
   11     8    >   ECHO                                                     '%24this+is+not+defined.%0A'
   13     9    > > RETURN                                                   null

End of function foo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.72 ms | 1393 KiB | 13 Q