i'm follow the example from the net, it's look like:
<?php
class example() {
var $buy;
function example() {
global $obj;
$this->buy = unserialize($obj);
while(list($x,$y)=each($this->buy)){
if($y < 1) {
unset($this->buy[$x]);
}
}
}
function add($item) {
if(!isset($this->buy[$item])) {
$this->buy[$item] = 0;
}
$this->buy[$item] += 1;
setcookie("obj",serialize($this->buy));
}
}
it will come out this error , so how can i store the cookie??
Notice: unserialize(): Error at offset 5 of 33 bytes in C:\test\class.php on line 7
Warning: Variable passed to each() is not an array or object in C:\test\class.php on line 8