3v4l.org

run code in 300+ PHP versions simultaneously
<?php class UserEntity{ protected $record = null; public function __construct(array $record){ $this->record = $record; } public function getEMail(){ return $this->record['email']; } } class UserRepository{ protected $pdo = null; public function __construct(?PDO $pdo){ $this->pdo = $pdo; } public function byId(int $id){ //faking. should probably be moved to a ::make method or something. return new UserEntity([ 'name' => 'John', 'email' => 'blah@blah.com', ]); } public function add(UserEntity $user){ //... } } $userRepository = new UserRepository(null); $user = $userRepository->byId(34); var_dump($user->getEMail());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RPVQ3
function name:  (null)
number of ops:  14
compiled vars:  !0 = $userRepository, !1 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $2      'UserRepository'
          1        SEND_VAL_EX                                              null
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   36     4        INIT_METHOD_CALL                                         !0, 'byId'
          5        SEND_VAL_EX                                              34
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   37     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !1, 'getEMail'
         10        DO_FCALL                                      0  $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

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

End of function __construct

Function getemail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RPVQ3
function name:  getEMail
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      'record'
          1        FETCH_DIM_R                                      ~1      ~0, 'email'
          2      > RETURN                                                   ~1
   12     3*     > RETURN                                                   null

End of function getemail

End of class UserEntity.

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

End of function __construct

Function byid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RPVQ3
function name:  byId
number of ops:  6
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        NEW                                              $1      'UserEntity'
   25     2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $1
   28     5*     > RETURN                                                   null

End of function byid

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

End of function add

End of class UserRepository.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
125.63 ms | 1405 KiB | 15 Q