Using an object as array key

Hi, i am trying to use an object as an array key and i just wanted to know if its possible, i cant seem to get it to work. I could probable store an ID and look up the object by ID but it would be nice if i could just use the object directly as the array key.


class year{
	var $start;
	var $end;
	var $weight;
	
	function year($start,$end,$weight){
		$this->start = $start;
		$this->end = $end;
		$this->weight = $weight;
	}
	
}

$yearObj = new year("start","end","weight");
$arr = array();
$arr[$yearObj][] = 5;
print_r($arr);
echo $arr[$yearObj][0];

Cheers,
Nick

No you cannot.

ok thanks :tup: