Core Function
View Source on Trac ↗ str_starts_with()
str_starts_with( mixed $haystack, mixed $needle ) Polyfill for `str_starts_with()` function added in PHP 8.0.
Parameters 2 required
| Name / Type | Description |
|---|---|
| $haystack string | The string to search in. Required |
| $needle string | The substring to search for in the `$haystack`. Required |
Return Value
(bool)
True if `$haystack` starts with `$needle`, otherwise false.
Function Information
Since Version
5.9.0
Source File
wp-includes/compat.php
Advertisement