What is String?
A PHP string is a collection of characters that can be used to save and manipulate text. PHP only supports a 256-character set, hence it doesn’t support Unicode natively.
The term “string” refers to a group of characters. PHP supports a number of data types, including strings.
Alphanumeric characters are allowed in string variables. When these conditions are met, strings are generated.
- You create a variable and assign it to string characters.
- With the echo statement, you can use PHP Strings directly.
- String functions in PHP are language constructs that aid in the capturing of words.
- Understanding how PHP strings work and manipulating them can help you become a more successful and productive developer.
In PHP, there are four different ways to specify a string literal.
- single quoted
- double quoted
- heredoc syntax
- newdoc syntax (since PHP 5.3)