3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Address { protected $city; public function getCity() { return $this->city; } public function setCity($city) { $this->city=$city; } } class Person { protected $name="Tester"; protected $address; public function __construct() { $this->address = new Address; } public function getName(){ return $this->name; } public function __call($method, $args){ if (method_exists($this->address,$method)) { return call_user_func_array( array($this->address,$method),$args); } } } $sharbear = new Person; echo $sharbear->setCity("Baltimore"); echo "Name: ",$sharbear->getName(),"\n"; echo "City: ",$sharbear->getCity();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Iqk2X
function name:  (null)
number of ops:  17
compiled vars:  !0 = $sharbear
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $1      'Person'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   31     3        INIT_METHOD_CALL                                         !0, 'setCity'
          4        SEND_VAL_EX                                              'Baltimore'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
   32     7        ECHO                                                     'Name%3A+'
          8        INIT_METHOD_CALL                                         !0, 'getName'
          9        DO_FCALL                                      0  $5      
         10        ECHO                                                     $5
         11        ECHO                                                     '%0A'
   33    12        ECHO                                                     'City%3A+'
         13        INIT_METHOD_CALL                                         !0, 'getCity'
         14        DO_FCALL                                      0  $6      
         15        ECHO                                                     $6
         16      > RETURN                                                   1

Class Address:
Function getcity:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Iqk2X
function name:  getCity
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_OBJ_R                                      ~0      'city'
          1      > RETURN                                                   ~0
    7     2*     > RETURN                                                   null

End of function getcity

Function setcity:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Iqk2X
function name:  setCity
number of ops:  4
compiled vars:  !0 = $city
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'city'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function setcity

End of class Address.

Class Person:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Iqk2X
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Address'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'address'
          3        OP_DATA                                                  $1
   19     4      > RETURN                                                   null

End of function __construct

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

End of function getname

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Iqk2X
function name:  __call
number of ops:  17
compiled vars:  !0 = $method, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        INIT_FCALL                                               'method_exists'
          3        FETCH_OBJ_R                                      ~2      'address'
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7      > JMPZ                                                     $3, ->16
   25     8    >   FETCH_OBJ_R                                      ~4      'address'
          9        INIT_ARRAY                                       ~5      ~4
         10        ADD_ARRAY_ELEMENT                                ~5      !0
         11        INIT_USER_CALL                                0          'call_user_func_array', ~5
         12        SEND_ARRAY                                               !1
         13        CHECK_UNDEF_ARGS                                         
         14        DO_FCALL                                      0  $6      
         15      > RETURN                                                   $6
   27    16    > > RETURN                                                   null

End of function __call

End of class Person.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.62 ms | 1405 KiB | 15 Q