3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $name; public function __construct($name) { $this->name = $name; } public function isTest() { return $this->name === 'test'; } } $things = array(); $things[] = new A('aaa'); $things[] = new A('bbb'); $things[] = new A('test'); $things[] = new A('ddd'); var_dump(array_filter($things, array('isTest', '$this')));

preferences:
62.32 ms | 402 KiB | 5 Q