<?php
class Foo {
public $name;
public $type;
public function __construct($name, $type) {
$this->name = $name;
$this->type = $type;
}
}
$array[] = new Foo('first', 0);
$array[] = new Foo('second', 0);
$array[] = new Foo('third', 1);
$array[] = new Foo('fourth', 1);
PD9waHAKY2xhc3MgRm9vIHsKCXB1YmxpYyAkbmFtZTsKCXB1YmxpYyAkdHlwZTsKCQoJcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRuYW1lLCAkdHlwZSkgewoJCSR0aGlzLT5uYW1lID0gJG5hbWU7CgkJJHRoaXMtPnR5cGUgPSAkdHlwZTsKCX0KfQoKJGFycmF5W10gPSBuZXcgRm9vKCdmaXJzdCcsIDApOwokYXJyYXlbXSA9IG5ldyBGb28oJ3NlY29uZCcsIDApOwokYXJyYXlbXSA9IG5ldyBGb28oJ3RoaXJkJywgMSk7CiRhcnJheVtdID0gbmV3IEZvbygnZm91cnRoJywgMSk7CgokZmlsdGVyID0gYXJyYXlfc2VhcmNoKDEsICRhcnJheSwgdHJ1ZSk7CgpwcmludF9yKCRmaWx0ZXIpOw==