- var_dump: documentation ( source)
- phpversion: documentation ( source)
- version_compare: documentation ( source)
- substr_compare: documentation ( source)
<?php
function endswith($string, $test) {
$strlen = strlen($string);
$testlen = strlen($test);
if ($testlen > $strlen) return false;
return substr_compare($string, $test, $strlen - $testlen) === 0;
}
if (version_compare(phpversion(), '5.1.0', '>')) {
var_dump(endswith("abcdefg", "defg"));
}