Possible Duplicate:
Parse error: syntax error, unexpected T_FUNCTION line 10 ? help?
Reference – What does this error mean in PHP?
This is the code which cause the error.
$remaining = array_filter($allmodels, function ($var) use ($existmodels) {
return !in_array($var, $existmodels);
});
Logic of the code is(below all are arrays)
$remaining = $allmodels - $existmodels;
I think My PHP version is outdated in the server. Is it the problem. How can I create a similar code snippet ?
Thanks
I am a big fan of OO programming, so just for the fun:
The class can be put in a separate file for reuse, and then just use the oneliner. And, of course the class can be extended with a kind of handy array operations.
Update
I realized that the oneliner only will work in php 5.4+, so for older versions use this:
Result in Codepad.