3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); class foo { static public function test() { var_dump(get_called_class()); } public function testTwo() { var_dump(get_called_class()); } } class bar extends foo { } class abc { function test() { foo::test(); bar::test(); } function testTwo() { foo::testTwo(); bar::testTwo(); } } echo "basic\n"; foo::test(); bar::test(); echo "basic without static declaration\n"; foo::testTwo(); bar::testTwo(); echo "in a class\n"; $abc = new abc(); $abc->test(); echo "in a class without static declaration\n"; $abc->testTwo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/57N9u
function name:  (null)
number of ops:  23
compiled vars:  !0 = $abc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 15
          2        DO_ICALL                                                 
   30     3        ECHO                                                     'basic%0A'
   31     4        INIT_STATIC_METHOD_CALL                                  'foo', 'test'
          5        DO_FCALL                                      0          
   32     6        INIT_STATIC_METHOD_CALL                                  'bar', 'test'
          7        DO_FCALL                                      0          
   34     8        ECHO                                                     'basic+without+static+declaration%0A'
   35     9        INIT_STATIC_METHOD_CALL                                  'foo', 'testTwo'
         10        DO_FCALL                                      0          
   36    11        INIT_STATIC_METHOD_CALL                                  'bar', 'testTwo'
         12        DO_FCALL                                      0          
   38    13        ECHO                                                     'in+a+class%0A'
   39    14        NEW                                              $6      'abc'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !0, $6
   40    17        INIT_METHOD_CALL                                         !0, 'test'
         18        DO_FCALL                                      0          
   42    19        ECHO                                                     'in+a+class+without+static+declaration%0A'
   43    20        INIT_METHOD_CALL                                         !0, 'testTwo'
         21        DO_FCALL                                      0          
         22      > RETURN                                                   1

Class foo:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/57N9u
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    8     4      > RETURN                                                   null

End of function test

Function testtwo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/57N9u
function name:  testTwo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   12     4      > RETURN                                                   null

End of function testtwo

End of class foo.

Class bar:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/57N9u
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    8     4      > RETURN                                                   null

End of function test

Function testtwo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/57N9u
function name:  testTwo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   12     4      > RETURN                                                   null

End of function testtwo

End of class bar.

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

End of function test

Function testtwo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/57N9u
function name:  testTwo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_STATIC_METHOD_CALL                                  'foo', 'testTwo'
          1        DO_FCALL                                      0          
   26     2        INIT_STATIC_METHOD_CALL                                  'bar', 'testTwo'
          3        DO_FCALL                                      0          
   27     4      > RETURN                                                   null

End of function testtwo

End of class abc.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.42 ms | 1392 KiB | 17 Q