Featured Posts

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.

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Post a comment

You must be logged in to post a comment.