I\'ve been looking into array_map but not sure if this is the best way to do it.
array_map
I am currently getting the following array returned from my scandir
scandir
You should be looking at array_filter() instead
$result = array_filter( $originalArray, function($value) { return (strpos($value, 'post-') === 0); } );
Though using glob() rather than scandir() would have allowed you to do the filter while actually retrieving the directory list