Here are Java like startsWith/endsWith implementations in PHP.
<?php
function startsWith($haystack,$needle)
{
$res=FALSE;
if(mb_strripos($haystack,$needle,0,"utf-8")==0)
$res= TRUE;
return $res;
}
function endsWith($haystack,$needle)
{
$res=FALSE;
$len=mb_strlen($haystack);
$pos=$len-mb_strlen($needle);
if(mb_strripos($haystack,$needle,0,"utf-8")==$pos)
$res= TRUE;
return $res;
}
?>