I just came upon a really good use for array_diff(). When reading a dir(opendir;readdir), I _rarely_ want "." or ".." to be in the array of files I'm creating. Here's a simple way to remove them:
<?php
$someFiles = array();
$dp = opendir("/some/dir");
while($someFiles[] = readdir($dp));
closedir($dp);
$removeDirs = array(".","..");
$someFiles = array_diff($someFiles, $removeDirs);
foreach($someFiles AS $thisFile) echo $thisFile."\n";
?>
S