<?php
class Foo {
	public $name;
	public $type;
	
	public function __construct($name, $type) {
		$this->name = $name;
		$this->type = $type;
	}
}

$s = new SplObjectStorage();

$first = new Foo('first', 0);
$second = new Foo('second', 0);
$third = new Foo('third', 1);
$fourth = new Foo('fourth', 1);

$s->attach($first);
$s->attach($second);
$s->attach($third);
$s->attach($fourth);

print_r($s);