fork(1) 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. {
  39. if ($rank = 1)
  40. {
  41. $salary = $startSalary;
  42. }
  43. elseif ($rank = 2)
  44. {
  45. $salary = $startSalary * 1.25;
  46. }
  47. elseif ($rank = 3)
  48. {
  49. $salary = $startSalary * 1.50;
  50. } else
  51. {
  52. echo "Слава Украине!";
  53. }
  54. return $salary;
  55. }
  56. public $salary = $this->getSalary();
  57. }
  58.  
  59. $worker = new ManagerWorker;
  60.  
  61. var_dump($worker);
Runtime error #stdin #stdout #stderr 0.01s 52488KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected '$this' (T_VARIABLE) in /home/Xt8WT9/prog.php on line 56