Is the first character uppercase
9 March 2007I needed to make a script in PHP to scan a page of text and return the top 10 keywords.
I decided to give more importance to words starting with uppercase characters. I couldn't find any PHP functions available, so I thought I would write my own. Hopefully someone finds this useful.
<?php
$string = 'Titanic';
function isFirstUC($string)
{
if(strstr($string[0], ucfirst($string[0])))
return True;
else
return False;
}
echo isFirstUC($string);
?>