3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Employee { public $name; public $department; public $salary; public function getAnnualBonus(){ return "$".$this->salary * 0.1; } } $employeeAlice = new Employee(); $employeeAlice->name = "Alice"; $employeeAlice->department = "IT"; $employeeAlice->salary = 80000; echo $employeeAlice-> getAnnualBonus(); echo "\n"; $employeeBob = new Employee(); $employeeBob->name = "Bob"; $employeeBob->department = "HR"; $employeeBob->salary = 60000; echo $employeeBob-> getAnnualBonus();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ap5Qp
function name:  (null)
number of ops:  26
compiled vars:  !0 = $employeeAlice, !1 = $employeeBob
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   NEW                                                  $2      'Employee'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   13     3        ASSIGN_OBJ                                                   !0, 'name'
          4        OP_DATA                                                      'Alice'
   14     5        ASSIGN_OBJ                                                   !0, 'department'
          6        OP_DATA                                                      'IT'
   15     7        ASSIGN_OBJ                                                   !0, 'salary'
          8        OP_DATA                                                      80000
   16     9        INIT_METHOD_CALL                                             !0, 'getAnnualBonus'
         10        DO_FCALL                                          0  $8      
         11        ECHO                                                         $8
   17    12        ECHO                                                         '%0A'
   18    13        NEW                                                  $9      'Employee'
         14        DO_FCALL                                          0          
         15        ASSIGN                                                       !1, $9
   19    16        ASSIGN_OBJ                                                   !1, 'name'
         17        OP_DATA                                                      'Bob'
   20    18        ASSIGN_OBJ                                                   !1, 'department'
         19        OP_DATA                                                      'HR'
   21    20        ASSIGN_OBJ                                                   !1, 'salary'
         21        OP_DATA                                                      60000
   22    22        INIT_METHOD_CALL                                             !1, 'getAnnualBonus'
         23        DO_FCALL                                          0  $15     
         24        ECHO                                                         $15
         25      > RETURN                                                       1

Class Employee:
Function getannualbonus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ap5Qp
function name:  getAnnualBonus
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                          ~0      'salary'
          1        MUL                                                  ~1      ~0, 0.1
          2        CONCAT                                               ~2      '%24', ~1
          3      > RETURN                                                       ~2
    9     4*     > RETURN                                                       null

End of function getannualbonus

End of class Employee.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.44 ms | 484 KiB | 9 Q