Hello,
I'm new at oop and i have a problem (although i think it is not an oop mistake but php)
Heres what i have:
Index.php:
<?php include("_classes.php"); error_reporting(E_ALL)?>
<?php
$family = new family;
$family->addPeople(2);
print_r ($family->showInfo());
?>
and classes:
class family
{
private $people = "0",
$food = "0",
$drink = "0",
$money = "0",
$data;
public function showInfo()
{
$data = array('People'=>"$this->people",
'Food'=>"$this->food",
'Drink'=>"$this->drink",
'Money'=>"$this->money"
);
return $data;
}
public function addPeople($mitu='1')
{
$this->people.=(int)$mitu;
return $this->showInfo();
}
}
?>
The problem is that it gives me People count 02, not 2. Any help and comment will be appreciated.