PHP 8 · Strings and arrays

Search in strings

Check the start, end or contents of a string.

str_contains($text, 'error');
str_starts_with($url, 'https://');
str_ends_with($file, '.php');

Official PHP 8 documentation

More strings and arrays commands

All strings and arrays commands · PHP 8 cheatsheet

Was this page helpful?