PSDtoHTML logo

Differentiate single and double quotation marks in PHP

When writing an expression, a constant or a variable in PHP which needs quotation marks you can always choose between using single quotation marks or double quotation marks. It really doesn’t matter if you choose single or double quotation marks, as long as it are straight marks (' of ") and not italic marks ( ‘ of “).

When your variable or expression consists of text (a string) you do need to differentiate single and double quotation marks. It is sometimes required to ‘escape’ the normal text processing. Therefore an escape can be used. When using double quotation marks multiple escape characters can be used contrary to using single quotation marks. An escape character needs to be indicated by means of a backslash \.



Was this useful?