Strings
Strings are text, pure and simple. There's two ways of storing strings, inside single quotes and double-quotes. Using "double-quotes" allows you to use special characters like \n for a newline. The backslash character marks the next character as special, though the only characters you can backslash in 'single-quoted' strings are \' (a single quote) and \\ (a backslash).
Some other special characters (for double-quoted strings)
Code:t
TAB
n
newline
r
carriage-return. In DOS text-files, a new line is \r\n, though in practice in Windows you can get away with UNIX format, which is just \n
The most important difference between single and double-quoted strings is that double-quoted strings can contain variable names:Code:$
$
'
'
"
"
Check out the manual for more string stuff -- this is generally enough to get along with in daily use.Code:$foo = 'This doesn\'t work'; // Oh yes it does!
$foo = "Matt's second line also works";
$age = 18;
echo 'Bob is $age'; // prints "Bob is $age"
echo "Bob is $age"; // prints "Bob is 18"
This tutorial was written by another one of my friends, if you would like to use this tutorial please send me a PM
Last edited by clookid; 01-10-2007 at 09:50 PM.
I like the last one, " are needed when inserting variables, right.
And who is the friend you are saying about, is he in codecall ?
No he is not in CodeCall, he is at another forum that I moderate.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks