<?php
class Foo {
	public $name;
	public $type;
	
	public function __construct($name, $type) {
		$this->name = $name;
		$this->type = $type;
	}
	
	public function searchZeroType($o) {
		return ($o->type == 0);
	}
	
	public function doubleType($o) {
		return $o->type = $o->type * 2; //Почему не получилось c return $o->type * 2;
	}
}

class SplObjectFunctions {
	public static function object_filter(callable $c, $objectStorage) {
		$s = new SplObjectStorage();
		
		foreach($objectStorage as $object) {
			if ($c($object)) {
				$s->attach($object);
			}
		}
		
		return $s;
	}
	
	public static function object_map(callable $c, $objectStorage) {
		$s = $objectStorage;
		
		foreach($s as $object) {
			$c($object);
		}
		
		return $s;
	}
}

$a = new SplObjectStorage();

$a->attach(new Foo('first', 1));
$a->attach(new Foo('second', 1));
$a->attach(new Foo('third', 0));
$a->attach(new Foo('fourth', 1));


$search = SplObjectFunctions::object_filter(array('Foo', 'searchZeroType'), $a);
$double = SplObjectFunctions::object_map(array('Foo', 'doubleType'), $a);

print_r($double);