Saturday, December 10, 2011

PHP Strings

A string is series of characters, where a character is the same as a byte, so PHP only supports a 256-character set.

How to use Strings

Single quoted strings
echo 'Hello World';
Double quoted strings
echo "Hello World";
Double quoted strings with variable
echo "$var1 Hello World";
Double quoted strings with variable inside curly braces
echo "{$var1} Hello World";
Concatenating Strings
echo "Hello" . " World";
echo "Hello" . $var1;
echo getvar1() . "Hello";

No comments:

Post a Comment