How to insert Double-quoted strings in PHP
Posted by admin | Posted in PHP, Software Programs, Theory Subjects | Posted on 19-11-2009
0
Sample Program
print "I've gone to the store."; print "The sauce cost \$10.25."; $cost = '$10.25'; print "The sauce cost $cost."; print "The sauce cost \$\061\060.\x32\x35.";
Output
I've gone to the store. The sauce cost $10.25. The sauce cost $10.25. The sauce cost $10.25.
The last line of prints the price of sauce correctly because the character 1 is ASCII code 49 decimal and 061 octal. Character 0 is ASCII 48 decimal and 060 octal; 2 is ASCII 50 decimal and 32 hex; and 5 is ASCII 53 decimal and 35 hex.
