fork download
  1. <?php
  2. public function calculateDepartmentTotalSalary() {
  3. $totalSalary = 0;
  4.  
  5. foreach ($this->employees as $key => $Employee) {
  6. $totalSalary += $Employee->salary; //Department.php line 30
  7. }
  8.  
  9. return $totalSalary;
  10. }
  11.  
  12. =====================================
  13. class Employee {
  14. public $name;
  15.  
  16. public $rang;
  17. public $salary;
  18. public $coffee;
  19. public $document;
  20. public $leader;
  21.  
  22. public function __construct($name, $salary, $coffee, $document, $rang = 1, $leader = false) {
  23. $this->name = $name;
  24. $this->salary = $salary;
  25. $this->coffee = $coffee;
  26. $this->document = $document;
  27. $this->rang = $rang;
  28. $this->leader = $leader;
  29.  
  30. $this->salary = $this->calculateSalary();
  31. $this->coffee = $this->calculateCoffee();
  32. $this->document = $this->calculateDocument();
  33. }
Runtime error #stdin #stdout #stderr 0.01s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected 'public' (T_PUBLIC) in /home/Weld9b/prog.php on line 2