3v4l.org

run code in 300+ PHP versions simultaneously
<?php class UserModel { protected $userName; protected $userPassword; public function __construct($name, $pass) { $this->setName($name) ->setPassword($pass); } public function setName($name) { $this->userName = $name; return $this; } public function setPassword($password) { $this->userPassword = UserModel::hashPassword($password); return $this; } public static function hashPassword($password) { return md5('salt : ' . $password); } public function authenticate($user, $pass) { return ($this->userName === $user && $this->userPassword === UserModel::hashPassword($pass)); } } $user = new UserModel('Spaux','password'); if ($user->authenticate('Spaux','password')) { echo "you've got spaux!"; } else { echo "Who?"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9I00M
function name:  (null)
number of ops:  14
compiled vars:  !0 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   NEW                                              $1      'UserModel'
          1        SEND_VAL_EX                                              'Spaux'
          2        SEND_VAL_EX                                              'password'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   35     5        INIT_METHOD_CALL                                         !0, 'authenticate'
          6        SEND_VAL_EX                                              'Spaux'
          7        SEND_VAL_EX                                              'password'
          8        DO_FCALL                                      0  $4      
          9      > JMPZ                                                     $4, ->12
   36    10    >   ECHO                                                     'you%27ve+got+spaux%21'
         11      > JMP                                                      ->13
   38    12    >   ECHO                                                     'Who%3F'
   39    13    > > RETURN                                                   1

Class UserModel:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9I00M
function name:  __construct
number of ops:  9
compiled vars:  !0 = $name, !1 = $pass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_METHOD_CALL                                         'setName'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
    9     5        INIT_METHOD_CALL                                         $2, 'setPassword'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
   10     8      > RETURN                                                   null

End of function __construct

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

End of function setname

Function setpassword:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9I00M
function name:  setPassword
number of ops:  9
compiled vars:  !0 = $password
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_STATIC_METHOD_CALL                                  'UserModel', 'hashPassword'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        ASSIGN_OBJ                                               'userPassword'
          5        OP_DATA                                                  $2
   19     6        FETCH_THIS                                       ~3      
          7      > RETURN                                                   ~3
   20     8*     > RETURN                                                   null

End of function setpassword

Function hashpassword:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9I00M
function name:  hashPassword
number of ops:  7
compiled vars:  !0 = $password
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        INIT_FCALL                                               'md5'
          2        CONCAT                                           ~1      'salt+%3A+', !0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
   24     6*     > RETURN                                                   null

End of function hashpassword

Function authenticate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/9I00M
function name:  authenticate
number of ops:  13
compiled vars:  !0 = $user, !1 = $pass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        FETCH_OBJ_R                                      ~2      'userName'
          3        IS_IDENTICAL                                     ~3      !0, ~2
          4      > JMPZ_EX                                          ~3      ~3, ->11
   28     5    >   FETCH_OBJ_R                                      ~4      'userPassword'
          6        INIT_STATIC_METHOD_CALL                                  'UserModel', 'hashPassword'
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0  $5      
          9        IS_IDENTICAL                                     ~6      $5, ~4
         10        BOOL                                             ~3      ~6
         11    > > RETURN                                                   ~3
   29    12*     > RETURN                                                   null

End of function authenticate

End of class UserModel.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.54 ms | 1400 KiB | 15 Q