PHP Basic Tutorial
MySQL Connection
PHP Advanced
Strings are sequences of characters used to store and manipulate text. PHP provides a variety of functions for working with strings, making it easy to create, modify, and manipulate text content.
The simplest way to create a string. It does not interpret variables or special characters (except for \\
and \'
).
Try it yourself
More flexible. They parse variables and escape sequences like \n
(newline).
Try it yourself
Method |
Description |
Example |
---|---|---|
strlen() |
Returns the length of a string |
|
str_word_count() |
Returns counts the number of words in a string |
|
strpos() |
Finds the position of the first occurrence of a substring in a string |
|
substr() |
Returns a portion of a string |