Hi,
I'm not very much used to with this kind of things, trying to call a class variable from a different page... Please look at the code below:
class.php
class bag{
private $no_of_items=0;
private $sub_total;
public function update(){
$this->no_of_items = $this->no_of_items++;
return true;
}
}
index.php
$cart = new bag;
//Some calculations...
$cart->update();
echo $cart->no_of_items; //output is right
product.php
//Some other code
echo $cart->no_of_items; //output is wrong
Why this output inside product.php is not updated as index.php? How to do this ???
Please help ... Thanks in advance.
Ahsan, Tokyo