Conditions | 4 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | public static function startsWith(string $haystack, string $needle, bool $ignoreCase = true): bool |
||
38 | { |
||
39 | if (false !== $ignoreCase) { |
||
40 | $function = \function_exists('mb_stripos') |
||
41 | ? 'mb_stripos' |
||
42 | : 'stripos'; |
||
43 | } else { |
||
44 | $function = \function_exists('mb_strpos') |
||
45 | ? 'mb_strpos' |
||
46 | : 'strpos'; |
||
47 | } |
||
48 | |||
49 | return 0 === $function($haystack, $needle); |
||
50 | } |
||
52 |