I have a custom WordPress plugin that works fine on my local dev machine, but triggers an error on the production server.
The function:
function _iniloader_get_dirs($dir) {
$dirs = array_filter(scandir($dir), function ($item) use ($dir) {
return (is_dir($dir.'/'.$item) && $item != "." && $item != "..");
});
// Use array_values to reset the array keys:
return array_values($dirs);
}
The error:
Parse error: syntax error, unexpected T_FUNCTION in (in plugin) on line 30
Line 30 is the second line of the function.
My local MAMP server = PHP Version 5.3.6
Linux production server = PHP Version 5.3.5
Does anyone have an idea what the issue could be, and why it would show up in one environment but not the other?
UPDATE:
I just noticed that, if I put this function in a regular PHP file on the production box, it executes fine- so it's only triggering the error when it's part of the WordPress plugin, which makes even less sense to me...