fork download
  1. <?php
  2.  
  3. class Skill
  4. {
  5. public $id=0;
  6. public $name="";
  7. public $glyphs=array();
  8.  
  9. public function __construct($id,$name)
  10. {
  11. $this->id=$id;
  12. $this->name=$name;
  13. }
  14. }
  15.  
  16. class Glyph
  17. {
  18. public $id;
  19. public $skill_id;
  20. public $name;
  21. public $description;
  22. public $cost;
  23. public $lvl_req;
  24. public $icon;
  25.  
  26. public function __construct($id,$skill_id,$name,$description,$cost,$lvl_req)
  27. {
  28. $this->id=$id;
  29. $this->skill_id=$skill_id;
  30. $this->name=$name;
  31. $this->description=$description;
  32. $this->cost=$cost;
  33. $this->lvl_req=$lvl_req;
  34. $this->icon="/images/glyphs".$name."png";
  35. }
  36. }
  37.  
  38. class Player
  39. {
  40. public $class;
  41. public $level;
  42. public $skills=array();
  43. public $points;
  44. }
  45.  
  46.  
  47. $player = new Player();
  48.  
  49. $skill = new Skill(11, 'Иммолейт импрувед');
  50.  
  51. $glyph = new Glyph(22,11,'immolate_improved','возможность его резиста КРАЙНЕ МАЛА',66, 80);
  52. $skill->glyphs[] = $glyph;
  53.  
  54. $player->skills[] = $skill;
  55.  
  56. var_dump($player->skills[0]->glyphs[0]);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
object(Glyph)#3 (7) {
  ["id"]=>
  int(22)
  ["skill_id"]=>
  int(11)
  ["name"]=>
  string(17) "immolate_improved"
  ["description"]=>
  string(66) "возможность его резиста КРАЙНЕ МАЛА"
  ["cost"]=>
  int(66)
  ["lvl_req"]=>
  int(80)
  ["icon"]=>
  string(34) "/images/glyphsimmolate_improvedpng"
}