Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class nowa
- {
- public $adres,$nazwisko,$imie;
- public $osoby = Array(
- array("Imie" => "","Nazwisko" => "","Adres" => ""),
- array("Imie" => "","Nazwisko" => "","Adres" => ""),
- array("Imie" => "","Nazwisko" => "","Adres" => "")
- );
- public function dodajOsobe($index,$imie,$nazwisko,$adres)
- {
- $this->osoby[$index]["Imie"] = $imie;
- $this->osoby[$index]["Nazwisko"] = $nazwisko;
- $this->osoby[$index]["Adres"] = $adres;
- }
- public function dejWszystkich() {
- for($i = 0; $i < count($this->osoby); $i++) {
- echo $this->osoby[$i]["Imie"] . " " . $this->osoby[$i]["Nazwisko"] . " " . $this->osoby[$i]["Adres"] . "<br>";
- }
- }
- }
- $grupaA = new nowa();
- $grupaB = new nowa();
- $grupaA->dodajOsobe(0,"Przemek","Róg","Dom");
- $grupaA->dodajOsobe(1,"Jarek","Róg","Ten sam dom");
- $grupaA->dodajOsobe(2,"Patryk","Tylec","Nie wiem");
- $grupaB->dodajOsobe(0,"Damian","Kuseks","Dom");
- $grupaB->dodajOsobe(1,"Mejzuro","Adamo","Inny dom");
- $grupaB->dodajOsobe(2,"Adriano","Kozioło","Jeszcze inny dom");
- $grupaA->dejWszystkich();
- echo "<br>";
- $grupaB->dejWszystkich();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement