PHP: Strings
Every string can be stored in a manner similar to explained in Variables section.
Example: $string_var = "Bob";
Double quotes permit you to use special charaters as follows:
|
<?php // All the string described belows are VALID. $string = "Hello world!"; $html_string = "<a href='my-webpage.html'> my home </a>"; $html_string_backslash= "<a href=\"my-webpage.html\"> my home </a>"; $special_char_string_newline = "hi. This is Bobby \n"; $special_char_string_tab = "hi. This is Bobby \t"; ?> |
Note that all the string defined above are valid. Also, note that we often need to enclose double quotes in HTML tags and then we can simply use single quote (') to handle the string as done in the variable $html_string above or use backslash(\) followed by double quotes (") to handle it.
All the special characters like \n, \t can also be included in string defined within double quotes (").

Recent comments
6 days 18 hours ago
2 weeks 4 days ago
4 weeks 2 hours ago
4 weeks 2 days ago
4 weeks 3 days ago
4 weeks 5 days ago
29 weeks 23 hours ago
29 weeks 4 days ago
29 weeks 4 days ago
30 weeks 10 hours ago