Mon Jan 07, 2013 3:18 pm
<?php
// check if string ends with specific sub-string
function endsWith($currentString, $target)
{
$length = strlen($target);
if ($length == 0) {
return true;
}
return (substr($currentString, -$length) === $target);
}
$mystr="Test String";
if(endsWith($mystr,"ing"))
echo "String ends with 'ing'";
else
echo "String doesn't end with 'ing'";
?>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.