Update string.utl.php

This commit is contained in:
Namhyeon Go 2018-09-27 01:59:17 +09:00 committed by GitHub
parent 1e777cc165
commit 92c03a28b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,3 +103,21 @@ if(!function_exists("read_storage_file_by_line")) {
return explode_by_line(read_storage_file($filename, $options));
}
}
if(!function_exists("startsWith")) {
function startsWith($haystack, $needle) {
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
}
if(!function_exists("endsWith")) {
function endsWith($haystack, $needle) {
$length = strlen($needle);
if($length == 0) {
return true;
}
return (substr($haystack, -$length) === $needle);
}
}