3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test{ static $count = 0; public function __construct(){ $this->method('from constructor in object context ($this->)'); Test::method('from constructor in static context (Test::)'); self::method('from constructor in static context (self::)'); } public function __call($name, $arguments){ switch($name){ case 'method': self::magicMethod('__call() '.$arguments[0]); } } public static function __callStatic($name, $arguments){ switch($name){ case 'method': self::magicMethod('__callStatic() '.$arguments[0]); } } protected static function magicMethod($arg){ self::$count++; echo('Call '. self::$count.' : '.$arg."\n"); } protected function test(){ } } $test = new Test(); $test->method('from outside in object context ($this->)'); Test::method('from outside in static context (Test::)');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4oddH
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   39     3        INIT_METHOD_CALL                                         !0, 'method'
          4        SEND_VAL_EX                                              'from+outside+in+object+context+%28%24this-%3E%29'
          5        DO_FCALL                                      0          
   41     6        INIT_STATIC_METHOD_CALL                                  'Test', 'method'
          7        SEND_VAL_EX                                              'from+outside+in+static+context+%28Test%3A%3A%29'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4oddH
function name:  __construct
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_METHOD_CALL                                         'method'
          1        SEND_VAL_EX                                              'from+constructor+in+object+context+%28%24this-%3E%29'
          2        DO_FCALL                                      0          
    9     3        INIT_STATIC_METHOD_CALL                                  'Test', 'method'
          4        SEND_VAL_EX                                              'from+constructor+in+static+context+%28Test%3A%3A%29'
          5        DO_FCALL                                      0          
   10     6        INIT_STATIC_METHOD_CALL                                  'method'
          7        SEND_VAL_EX                                              'from+constructor+in+static+context+%28self%3A%3A%29'
          8        DO_FCALL                                      0          
   11     9      > RETURN                                                   null

End of function __construct

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4oddH
function name:  __call
number of ops:  11
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        IS_EQUAL                                                 !0, 'method'
          3      > JMPNZ                                                    ~2, ->5
          4    > > JMP                                                      ->10
   16     5    >   INIT_STATIC_METHOD_CALL                                  'magicMethod'
          6        FETCH_DIM_R                                      ~3      !1, 0
          7        CONCAT                                           ~4      '__call%28%29+', ~3
          8        SEND_VAL_EX                                              ~4
          9        DO_FCALL                                      0          
   18    10    > > RETURN                                                   null

End of function __call

Function __callstatic:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4oddH
function name:  __callStatic
number of ops:  11
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        IS_EQUAL                                                 !0, 'method'
          3      > JMPNZ                                                    ~2, ->5
          4    > > JMP                                                      ->10
   23     5    >   INIT_STATIC_METHOD_CALL                                  'magicMethod'
          6        FETCH_DIM_R                                      ~3      !1, 0
          7        CONCAT                                           ~4      '__callStatic%28%29+', ~3
          8        SEND_VAL_EX                                              ~4
          9        DO_FCALL                                      0          
   26    10    > > RETURN                                                   null

End of function __callstatic

Function magicmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4oddH
function name:  magicMethod
number of ops:  9
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   29     1        PRE_INC_STATIC_PROP                                      'count'
   30     2        FETCH_STATIC_PROP_R          unknown             ~2      'count'
          3        CONCAT                                           ~3      'Call+', ~2
          4        CONCAT                                           ~4      ~3, '+%3A+'
          5        CONCAT                                           ~5      ~4, !0
          6        CONCAT                                           ~6      ~5, '%0A'
          7        ECHO                                                     ~6
   31     8      > RETURN                                                   null

End of function magicmethod

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

End of function test

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.71 ms | 1390 KiB | 13 Q