\n - Newline or Linefeed \r - Carriage return \t - Horizontal tab \v - Vertical tab \e - Escape \f - Form feed \\ - Backslash \$ - Dollar sign \" - Double-quote " Įcho "'Single quotes here have no issues. Variable names are expanded in Double quoted Stringsĭouble quoted Strings interprets more escape sequences then Single quoted strings. ENTNOQUOTES, Will leave both double and single quotes unconverted. Strings do not have any fixed limits or ranges. Unlike other data types like integers, doubles, etc. In this article, we will learn about the working of the various string functions and how to implement them along with some special properties of strings. : $var = "Double quoted String" Įscape sequences are expanded in Double quoted Strings ENTQUOTES, Will convert both double and single quotes. PHP treats everything inside double quotes ( ) as Strings. My Name is $var, err!!, variables won't expand.ĭouble quoted String literals are enclosed with double quote characters ("). We can have multi-line Single quote strings. $text = str_replace($targets,$results,$text) 5) remove Windows-1252 symbols like "TradeMark", "Euro". Nowdoc syntax (since PHP 5.3.0) Single quoted Strings in PHP Single quoted strings are enclosed with (single quote character) Variables and escape sequences for special characters are not expanded in Single quoted strings. $trans = 'Ÿ' // Latin Capital Letter Y With Diaeresis $trans = '›' // Single Right-Pointing Angle Quotation Mark $trans = 'š' // Latin Small Letter S With Caron $trans = '”' // Right Double Quotation Mark $trans = '“' // Left Double Quotation Mark $trans = '’' // Right Single Quotation Mark $trans = '‘' // Left Single Quotation Mark If you use single quotes then PHP reads the string exactly as you typed it. IMO it would be much easier to write the string in double quotes string ' The problem with htmlentities () is that it is not very powerful, in fact, it does not escape single quotes, cannot detect the character set and does not validate HTML as well. This function escapes all HTML characters in a string and renders the string safe. $trans = 'Š' //
$trans = '
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |