我有一些代码已经使用
PHP中的USE函数为PHP 5.3.0编写
有人可以帮我改变这个为5.2.9工作吗?
$available = array_filter($objects,function ($object) use ($week) { return !in_array($object,$week); });
谢谢您的帮助
不好,但这将是一个等效的实现.
class MyWeekFilter { protected $_week; public function __construct($week) { $this->_week = $week; } public function filter($object) { return !in_array($object,$this->_week); } } $filter = new MyWeekFilter($week); $available = array_filter($objects,array($filter,'filter'));