fork(1) download
  1. <?php
  2.  
  3. class Animal
  4. {
  5. public $x;
  6. public $y;
  7.  
  8. }
  9.  
  10. class Mouse extends Animal
  11. {
  12. public $icon;
  13. public function makeStep()
  14. {
  15.  
  16. }
  17. }
  18.  
  19. class Cat extends Animal
  20. {
  21. public $icon;
  22. public function makeStep()
  23. {
  24.  
  25. }
  26. }
  27.  
  28. class World
  29. {
  30. public $map = [];
  31.  
  32. public function __construct($m, $n)
  33. {
  34. $this->map = array_fill(1, $m, array_fill(1, $n, 0));
  35. }
  36.  
  37. public function drawMap()
  38. {
  39. foreach ($this->map as $lines){
  40. for ($i=1; $i <= count($lines); $i++) {
  41. echo " " . $lines[$i] . " ";
  42. }
  43. echo "\n";
  44. }
  45. }
  46.  
  47. }
  48.  
  49. $testWorld = new World(2, 3);
  50.  
  51. $testWorld->drawMap();
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
 0  0  0 
 0  0  0