got mine to work... had to use a seperate var for the arrays... otherwise got funky debug outputs....
doesnt take into consideration keywords at the end... why? because no author in their right mind should end a title using any of those words :p
<?
function overlook_html_and_keywords_and_sort($a, $b)
{
$kto = array(' an ', ' the ', ' a '); //keywords to ignore
$temp_a = strtolower(strip_tags($a));
$temp_a = str_replace($kto, ' ', $temp_a);
$temp_a2 = explode(' ', $temp_a);
$temp_b = strtolower(strip_tags($b));
$temp_b = str_replace($kto, ' ', $temp_b);
$temp_b2= explode(' ', $temp_b);
for($i=0; $i<sizeof($kto);$i++)
{
$temp_a2[0] = str_replace(trim($kto[$i]), '', $temp_a2[0]); //remove whitespaces and check first words
$temp_b2[0] = str_replace(trim($kto[$i]), '', $temp_b2[0]); //same as above
}
$temp_a = trim(implode(' ', $temp_a2)); //remove whitespaces resulting from blank first or last indexs
$temp_b = trim(implode(' ', $temp_b2)); //same as above
return strcmp($temp_a,$temp_b);
}
$arr = Array (
'The Magic of Atlantis: About Poseidonis and Clark Ashton Smith',
'Zothique - Postscript',
'Poems Till Now Unpublished [Introduction to Grotesques and Fantastiques]',
'Exclusive Interviews: E. Hoffman [sic]',
'Introduction to Odes and Sonnets',
'Live from Auburn: The Elder Tapes - Introduction'
);
echo '<pre>';
print_r($arr);
echo '</pre><br><br>';
usort($arr, 'overlook_html_and_keywords_and_sort');
echo '<pre>';
print_r($arr);
echo '</pre>';
?>