Return a copy of the array with falsy values removed public function compact ($collection =null) { list ($collecti ON) = Self::_wrapargs (Func_get_args (), 1); $collection = Self::_collection ($collection); $__ = new Self; Return Self::_wrap ($__->select ($collection, function ($val) { return (bool) $val; })); }
function ($val) {
Code from PHP underscore, this place error, does not seem to be able to do parameters.
Reply content:
Return a copy of the array with falsy values removed public function compact ($collection =null) { list ($collecti ON) = Self::_wrapargs (Func_get_args (), 1); $collection = Self::_collection ($collection); $__ = new Self; Return Self::_wrap ($__->select ($collection, function ($val) { return (bool) $val; })); }
function ($val) {
Code from PHP underscore, this place error, does not seem to be able to do parameters.
function ($val) {
This notation is a function of lambda functions (anonymous functions), which used to appear in the scripting languages such as JS. However, starting with PHP 5.3, this anonymous function is supported. So you have a problem is not enough PHP version, upgrade to the latest version of PHP 5.3.x can solve this problem.