- substr: documentation ( source)
- var_dump: documentation ( source)
- phpversion: documentation ( source)
- version_compare: documentation ( source)
<?php
function endswith($haystack, $needle) {
$length = strlen($needle);
if ($length == 0) {
return true;
}
return (substr($haystack, -$length) === $needle);
}
if (version_compare(phpversion(), '5.1.0', '>')) {
var_dump(endswith("abcdefg", "abc"));
}