3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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/5D2m2
function name:  (null)
number of ops:  20
compiled vars:  !0 = $abc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ECHO                                                     'basic%0A'
   29     1        INIT_STATIC_METHOD_CALL                                  'foo', 'test'
          2        DO_FCALL                                      0          
   30     3        INIT_STATIC_METHOD_CALL                                  'bar', 'test'
          4        DO_FCALL                                      0          
   32     5        ECHO                                                     'basic+without+static+declaration%0A'
   33     6        INIT_STATIC_METHOD_CALL                                  'foo', 'testTwo'
          7        DO_FCALL                                      0          
   34     8        INIT_STATIC_METHOD_CALL                                  'bar', 'testTwo'
          9        DO_FCALL                                      0          
   36    10        ECHO                                                     'in+a+class%0A'
   37    11        NEW                                              $5      'abc'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !0, $5
   38    14        INIT_METHOD_CALL                                         !0, 'test'
         15        DO_FCALL                                      0          
   40    16        ECHO                                                     'in+a+class+without+static+declaration%0A'
   41    17        INIT_METHOD_CALL                                         !0, 'testTwo'
         18        DO_FCALL                                      0          
         19      > RETURN                                                   1

Class foo:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5D2m2
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    6     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/5D2m2
function name:  testTwo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   10     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/5D2m2
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    6     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/5D2m2
function name:  testTwo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   10     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/5D2m2
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_STATIC_METHOD_CALL                                  'foo', 'test'
          1        DO_FCALL                                      0          
   19     2        INIT_STATIC_METHOD_CALL                                  'bar', 'test'
          3        DO_FCALL                                      0          
   20     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/5D2m2
function name:  testTwo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'foo', 'testTwo'
          1        DO_FCALL                                      0          
   24     2        INIT_STATIC_METHOD_CALL                                  'bar', 'testTwo'
          3        DO_FCALL                                      0          
   25     4      > RETURN                                                   null

End of function testtwo

End of class abc.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.29 ms | 1400 KiB | 15 Q