This is a nice snippet but a a minor change that could improve it a bit. The extension could be treated differently so you can specify no extension and only grab files with no extensions. Would be easy to do like this:
function directoryToArray($directory, $extension = false, $full_path = true) {
if ($extension !== false && strlen($extension)) { $extension = \"\.$extension\"; }
And the if statement that checks for a condition:
if($extension !== false || (ereg(\"$extension\$\", $file)))
Then leaving an empty string would return all files with no extensions, or specifying false (or leaving it empty) will return all files.