View Single Post
  #5 (permalink)  
Old 03-10-2009, 10:46 AM
grace55 grace55 is offline
Administrator
Site Admin
 
Join Date: Jun 2008
Posts: 342
Default A journey leads to php....

Pull some Strings...

In PHP, as a general rule, a String is any line of text contained within quotation marks. You can use either double quotation marks (“) or single quotation marks also known as apostrophes (‘) in a string. Strings could be considered the building blocks of PHP, considering most all data is going to come from what’s in a string.

<?php
$double = "quotation marks.";
$single = 'single quotes.';
?>


When using single quotes, you need to “escape” the apostrophe with the slash (just like you would with double quotation marks) if you wish to display it in the output text...

<?php
echo 'Wouldn\'t you like a bagel?';
?>


Special commands within strings...

There are some “secret commands” you can use within strings to manipulate the output text:

\n: makes a new line
\r: a carriage return
\t: a tab
\$: shows a dollar sign
- remember PHP will be looking for a variable if you want to display a dollar sign and don’t use a slash...and throw an ugly error!
__________________
Christian Prayer Forum
Reply With Quote