String data type

PHP string is used to manipulate and store text . String varible contains can use string variable directly in function or stored variabes after use . The string functions are part of the PHP core. The single quotes, double quotes, and escape sequences can to use PHP string varible.

Php String Syntax

Variable ='string';

Below example first storing it into a variable and second case we print string through echo statement.

Php String Example

$my_first_string = "Tutorialsscripts!";
echo 'TutorialsScripts!';
echo "<br>";
echo $my_first_string;

out put:


In the above example the first string will be stored into the variable $my_first_string . The second will be used in 'echo' statement and not be stored variable.if you need single code to output you use backslash front of single single-quote.

Example :

echo 'TutorialsScripts- It\'s Neat!';

PHP String Functions

Here are the some of PHP string functions