← All built-ins / str_ends_with()
str_ends_with()
str_ends_with(string $haystack, string $needle): bool
Parameters
| Name | Type | Description |
|---|---|---|
| $haystack | string | string to test |
| $needle | string | required suffix |
Return value
true when $haystack ends with $needle.
Example
var_dump(str_ends_with("holy.php", ".php"));
var_dump(str_ends_with("holy.php", "holy"));bool(true) bool(false)