Nov
28
2008

Strings and Patterns: Quoting

In the PHP5 Zend Certification has a section under Strings and Patterns called Quoting. The Zend Study Guide does not contain the word Quoting neither does php manual.

Is it referring to Quotation mark, Grave accent and Apostrophe. What do you guys think?

Single Quotes (single quotation mark) are used with simple strings where all characters are used literally.

 echo 'simple string';
echo 'not so simple '.$variable;

Double Quotes escalate complex strings for use with complex characters (such as control characters \x2a) and embedding variables within a string.
Including the use of braces {$variable} within double quotes:

$variable = "variable";
echo "simple string useing double quotes <br>";
echo "double quote useing $variable <br>";
echo "double quote useing multiple {$variable}s <br>";
echo "double quote with \" double quotes \" within it <br>";
echo "double quote with control characters \x2a <br>";
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati
  • TwitThis
Written by Adam in: 07. Strings and Patterns |

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

WordPress Powered, Theme by TheBuckmaker.com | Add to Technorati Favorites. | RSS and Comments RSS