3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Student { private $name; public function __construct(string $name) { $this->name = $name; } public function getName(): string { return $this->name; } } class Secretary { private $students = []; public function addStudent(Student $s): Secretary { array_push($this->students, $s); return $this; } public function getStudents(): array { return $this->students; } } $s = new Secretary(); $s->addStudent(new Student('Foo')); var_dump($s->getStudents());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CYVG1
function name:  (null)
number of ops:  15
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'Secretary'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   35     3        INIT_METHOD_CALL                                         !0, 'addStudent'
          4        NEW                                              $4      'Student'
          5        SEND_VAL_EX                                              'Foo'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $4
          8        DO_FCALL                                      0          
   37     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'getStudents'
         11        DO_FCALL                                      0  $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class Student:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CYVG1
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   10     3      > 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/CYVG1
function name:  getName
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   15     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getname

End of class Student.

Class Secretary:
Function addstudent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CYVG1
function name:  addStudent
number of ops:  11
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        INIT_FCALL                                               'array_push'
          2        FETCH_OBJ_W                                      $1      'students'
          3        SEND_REF                                                 $1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   25     6        FETCH_THIS                                       ~3      
          7        VERIFY_RETURN_TYPE                                       ~3
          8      > RETURN                                                   ~3
   26     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function addstudent

Function getstudents:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CYVG1
function name:  getStudents
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   FETCH_OBJ_R                                      ~0      'students'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   31     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getstudents

End of class Secretary.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.01 ms | 1004 KiB | 15 Q