How to insert Single-quoted strings in PHP
Posted by admin | Posted in PHP, Software Programs, Theory Subjects | Posted on 19-11-2009
0
Single-quoted strings
print 'I have gone to the store.'; print 'I\'ve gone to the store.'; print 'Would you pay \$1.75 for 8 ounces of tap water?'; print 'In double-quoted strings, newline is represented by \n'; Output I have gone to the store. I've gone to the store. Would you pay $1.75 for 8 ounces of tap water? In double-quoted strings, newline is represented by \n
Because PHP doesn’t check for variable interpolation or almost any escape sequences in single-quoted strings, defining strings this way is straightforward and fast.
