1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?php /** * Class AMP_String_Utils * * @package AMP */
/** * Class with static string utility methods. * * @internal */ class AMP_String_Utils {
/** * Checks whether a given string ends in the given substring. * * @param string $haystack Input string. * @param string $needle Substring to look for at the end of $haystack. * @return bool True if $haystack ends in $needle, false otherwise. */ public static function endswith( $haystack, $needle ) { return '' !== $haystack && '' !== $needle && substr( $haystack, -strlen( $needle ) ) === $needle; } }
|