string functions API Reference
PHP's built-in string functions for measuring, searching, slicing, replacing and transforming strings.
string functions
Procedural string functions provided by the PHP standard library.
strlen(string $string): intReturns the length of the given string in bytes (not characters).
Returns: int
strpos(string $haystack, string $needle, int $offset = 0): int|falseFinds the numeric position of the first occurrence of needle in haystack. Returns false if not found.
Returns: int|false
substr(string $string, int $offset, ?int $length = null): stringReturns the portion of string specified by offset and length.
Returns: string
str_replace(array|string $search, array|string $replace, string|array $subject): string|arrayReplaces all occurrences of search with replace in subject.
Returns: string|array
strtolower(string $string): stringReturns string with all ASCII alphabetic characters converted to lowercase.
Returns: string
explode(string $separator, string $string, int $limit = PHP_INT_MAX): arraySplits a string by a separator and returns an array of the pieces.
Returns: array
trim(string $string, string $characters = " \n\r\t\v\x00"): stringStrips whitespace (or other characters) from the beginning and end of a string.
Returns: string