- They are sequences of characters, like "PHP supports string operations".
NOTE: Built-in string functions is given in function reference PHP String Functions.
Following are valid examples of string:
$string_1 = "This is a string in double quotes";
$string_2 = "This is a somewhat longer, singly quoted string";
$string_39 = "This string has thirty-nine characters";
$string_0 = ""; // a string with zero characters
Example:
The escape-sequence replacements are −
- \n is replaced by the newline character
- \r is replaced by the carriage-return character
- \t is replaced by the tab character
- \$ is replaced by the dollar sign itself ($)
- \" is replaced by a single double-quote (")
- \\ is replaced by a single backslash (\)
String Concatenation Operator:
- To concatenate two string variables together, use the dot (.) operator.
Using the strlen() Function:
- The strlen() function is used to find the length of a string.
Using the strpos() Function:
- The strpos() function is used to search for a string or character within a string.
PHP Parser:
- Specifically is part that reads human-readable representation of code to generate parse tree and later opcode representation of code that can be interpreted by php interpreter.
Example :
- I have taken Stona FIGSI'16 < www.stonafigsi.com > website menu bar for doing string manipulation using parser method and extracting the text from source code.
Output Generated:
No comments:
Post a Comment