startsWith():
function startsWith($haystack, $needle){ ???return strncmp($haystack, $needle, strlen($needle)) === 0;}
endsWith():
function endsWith($haystack, $needle){ ???return $needle === ‘‘ || substr_compare($haystack, $needle, -strlen($needle)) === 0;}
参考:https://www.gowhich.com/blog/747
https://leonax.net/p/7804/string-startswith-and-endswith-in-php/
实现php的startsWith和endsWith
原文地址:https://www.cnblogs.com/tommy-huang/p/9357631.html