3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public static $instance; protected $myVar = 'foo'; public function __call($name, $args) { return call_user_func_array(array($this, $name), $args); } public static function __callStatic($name, $args) { return call_user_func_array(array(self::getInstance(), $name), $args); } public static function getInstance() { return self::$instance ? : new self; } protected function getMyVar() { echo $this->myVar; } protected function setMyVar($value) { $this->myVar = $value; return $this; } } echo Test::setMyVar(15)->getMyVar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7Kgc
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_STATIC_METHOD_CALL                                  'Test', 'setMyVar'
          1        SEND_VAL_EX                                              15
          2        DO_FCALL                                      0  $0      
          3        INIT_METHOD_CALL                                         $0, 'getMyVar'
          4        DO_FCALL                                      0  $1      
          5        ECHO                                                     $1
          6      > RETURN                                                   1

Class Test:
Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7Kgc
function name:  __call
number of ops:  11
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        FETCH_THIS                                       ~2      
          3        INIT_ARRAY                                       ~3      ~2
          4        ADD_ARRAY_ELEMENT                                ~3      !0
          5        INIT_USER_CALL                                0          'call_user_func_array', ~3
          6        SEND_ARRAY                                               !1
          7        CHECK_UNDEF_ARGS                                         
          8        DO_FCALL                                      1  $4      
          9      > RETURN                                                   $4
   11    10*     > RETURN                                                   null

End of function __call

Function __callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7Kgc
function name:  __callStatic
number of ops:  12
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        INIT_STATIC_METHOD_CALL                                  'getInstance'
          3        DO_FCALL                                      0  $2      
          4        INIT_ARRAY                                       ~3      $2
          5        ADD_ARRAY_ELEMENT                                ~3      !0
          6        INIT_USER_CALL                                0          'call_user_func_array', ~3
          7        SEND_ARRAY                                               !1
          8        CHECK_UNDEF_ARGS                                         
          9        DO_FCALL                                      1  $4      
         10      > RETURN                                                   $4
   16    11*     > RETURN                                                   null

End of function __callstatic

Function getinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7Kgc
function name:  getInstance
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instance'
          1        JMP_SET                                          ~1      ~0, ->5
          2        NEW                          self                $2      
          3        DO_FCALL                                      0          
          4        QM_ASSIGN                                        ~1      $2
          5      > RETURN                                                   ~1
   21     6*     > RETURN                                                   null

End of function getinstance

Function getmyvar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7Kgc
function name:  getMyVar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~0      'myVar'
          1        ECHO                                                     ~0
   26     2      > RETURN                                                   null

End of function getmyvar

Function setmyvar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7Kgc
function name:  setMyVar
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   30     1        ASSIGN_OBJ                                               'myVar'
          2        OP_DATA                                                  !0
   31     3        FETCH_THIS                                       ~2      
          4      > RETURN                                                   ~2
   32     5*     > RETURN                                                   null

End of function setmyvar

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.73 ms | 1012 KiB | 13 Q