fork download
  1. <?php
  2.  
  3. abstract class AbstractWorker
  4. {
  5. protected $startSalary;
  6. public $coffee;
  7. public $pages;
  8. public $rank = 1;
  9. protected function getSalary()
  10. {
  11. if ($rank = 1)
  12. {
  13. $salary = $startSalary;
  14. }
  15. elseif ($rank = 2)
  16. {
  17. $salary = $startSalary * 1.25;
  18. }
  19. elseif ($rank = 3)
  20. {
  21. $salary = $startSalary * 1.50;
  22. } else
  23. {
  24. echo "Слава Украине!";
  25. }
  26. return $salary;
  27. }
  28. public $salary = getSalary;
  29. }
  30.  
  31. class ManagerWorker extends AbstractWorker
  32. {
  33. protected $startSalary = 500;
  34. public $coffee = 20;
  35. public $pages = 200;
  36. public $rank = 1;
  37. protected function getSalary($rank)
  38. $this->rank = $rank;
  39. {
  40. if ($rank = 1)
  41. {
  42. $salary = $startSalary;
  43. }
  44. elseif ($rank = 2)
  45. {
  46. $salary = $startSalary * 1.25;
  47. }
  48. elseif ($rank = 3)
  49. {
  50. $salary = $startSalary * 1.50;
  51. } else
  52. {
  53. echo "Слава Украине!";
  54. }
  55. return $salary;
  56. }
  57. public $salary = $this->getSalary();
  58. }
  59.  
  60. $worker = new ManagerWorker;
  61.  
  62. var_dump($worker);
Runtime error #stdin #stdout #stderr 0s 52488KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected '$this' (T_VARIABLE), expecting ';' or '{' in /home/a5zTYq/prog.php on line 38