Syntax error in the ignoring the display of non-image files in an array. Help?

Error: “Parse error: syntax error, unexpected T_FUNCTION”
Php Version: 5.2.17

Problem line:
#removing ignored files
$files = array_filter($files, function($file) use ($ignore) {return !in_array($file, $ignore);});

[php]

<?php $path = ("../photos/wide/"); $files = scandir($path); $ignore = array( 'cgi-bin', '.', '..'); #removing ignored files $files = array_filter($files, function($file) use ($ignore) {return !in_array($file, $ignore);}); #getting the modification time for each file $times = array_map(function($file) use ($path) {return filemtime("$path/$file");}, $files); #sort the times array while sorting the files array as well array_multisort($times, SORT_DESC, SORT_NUMERIC, $files); foreach ($files as $file) { echo '
'; } ?>

[/php]

function is not a function name, it tells php that the following code is a function.

Sponsor our Newsletter | Privacy Policy | Terms of Service