7
/* pretty nifty object oriented code! */
10
public $first_name,$family_name,$address,$phone_num;
13
echo "User information\n";
14
echo "----------------\n\n";
15
echo "First name:\t ".$this->first_name."\n";
16
echo "Family name:\t ".$this->family_name."\n";
17
echo "Address:\t ".$this->address."\n";
18
echo "Phone:\t\t ".$this->phone_num."\n";
21
function initialize($first_name,$family_name,$address,$phone_num)
23
$this->first_name = $first_name;
24
$this->family_name = $family_name;
25
$this->address = $address;
26
$this->phone_num = $phone_num;
32
{ /* one can pass classes as arguments */
35
$t->address = "New address...";
36
return $t; /* and also return them as return values */
42
$user1->initialize("Zeev","Suraski","Ben Gourion 3, Kiryat Bialik, Israel","+972-4-8713139");
43
$user2->initialize("Andi","Gutmans","Haifa, Israel","+972-4-8231621");
57
Address: Ben Gourion 3, Kiryat Bialik, Israel
66
Address: Haifa, Israel
75
Address: Haifa, Israel
84
Address: New address...