|
strlen()
|
strlen(string $string): int
|
Returns the length of a string in bytes. Use mb_strlen() for multibyte/Unicode strings.
|
Details →
|
|
str_replace()
|
str_replace(mixed $search, mixed $replace, mixed $...
|
Replaces all occurrences of the search string with the replacement string. Case-sensitive.
|
Details →
|
|
strpos()
|
strpos(string $haystack, string $needle, int $offs...
|
Finds position of first occurrence of a substring. Returns false if not found — always use strict comparison (!==).
|
Details →
|
|
substr()
|
substr(string $string, int $offset, ?int $length =...
|
Returns part of a string, starting at offset for the given length. Negative offset counts from the end.
|
Details →
|
|
strtolower() / strtoupper()
|
strtolower(string $string): string
|
Converts a string to lowercase or uppercase. Use mb_ variants for multibyte/Unicode text.
|
Details →
|
|
trim()
|
trim(string $string, string $characters = " \n\r\t...
|
Strips whitespace from both ends of a string. ltrim() strips left only; rtrim() strips right only.
|
Details →
|
|
explode() / implode()
|
explode(string $separator, string $string): array
|
explode() splits a string into an array by separator; implode() (alias: join) joins an array into a string.
|
Details →
|
|
sprintf()
|
sprintf(string $format, mixed ...$values): string
|
Returns a formatted string. Common specifiers: %s (string), %d (integer), %f (float), %05d (zero-padded).
|
Details →
|
|
preg_match() / preg_replace()
|
preg_match(string $pattern, string $subject, array...
|
preg_match() performs a regex search returning match count; preg_replace() replaces regex matches.
|
Details →
|
|
htmlspecialchars()
|
htmlspecialchars(string $string, int $flags = ENT_...
|
Converts special HTML characters to entities. Essential for preventing XSS when outputting user data.
|
Details →
|