3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface User{ // User接口 public function getName(); public function setName($_name); } class NormalUser implements User { // 实现接口的类. private $name; public function getName(){ return $this->name; } public function setName($_name){ $this->name = $_name; } } class UserAdmin{ //操作. public static function ChangeUserName(User $_user,$_userName){ $_user->setName($_userName); } } $normalUser = new NormalUser(); UserAdmin::ChangeUserName($normalUser,"Tom");//这里传入的是 NormalUser的实例. echo $normalUser->getName(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbWZI
function name:  (null)
number of ops:  12
compiled vars:  !0 = $normalUser
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'normaluser'
   20     1        NEW                                              $1      'NormalUser'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   21     4        INIT_STATIC_METHOD_CALL                                  'UserAdmin', 'ChangeUserName'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'Tom'
          7        DO_FCALL                                      0          
   22     8        INIT_METHOD_CALL                                         !0, 'getName'
          9        DO_FCALL                                      0  $5      
         10        ECHO                                                     $5
   23    11      > RETURN                                                   1

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

End of function getname

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

End of function setname

End of class User.

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

End of function getname

Function setname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbWZI
function name:  setName
number of ops:  4
compiled vars:  !0 = $_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   13     3      > RETURN                                                   null

End of function setname

End of class NormalUser.

Class UserAdmin:
Function changeusername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbWZI
function name:  ChangeUserName
number of ops:  6
compiled vars:  !0 = $_user, !1 = $_userName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        INIT_METHOD_CALL                                         !0, 'setName'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
   18     5      > RETURN                                                   null

End of function changeusername

End of class UserAdmin.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.51 ms | 1399 KiB | 13 Q