PHP String Function:
A string is nothing but a series of characters. Most easiest way to specify the string is to enclose it in single quotes (' ').
If we need to specify a string literal within single quote then we must use backslash (\). To specify any special character we need to use backslash, even if we want to print backslash.
In the following example we will also learn about new feature of PHP 5.0 called heredocs, in this technique we do not need to mention any single or double quote instead of that all we have to do is after echo statement start the statement with <<< followed by any string and the whole content must be ended with the same string. It facilitates us to not to bother about to print the special characters like \,",' etc. We can freely print these all.
PHP String Function Example:
$a="This is a string";
This is a string
string(16) "This is a string"
This is another way of printing "string".
Posted on: March 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles