In the previous section, you saw how to put numbers into variables. But you can also put text into your variables. Suppose you want to know something about the coats you own. Are they Winter coats? Jackets? Summer coats? You decide to catalogue this, as well. You can put direct text into your variables. You do it in a similar way to storing numbers: phpsu.com
$coats1 = "Winter Coats"; phpsu
Again, our variable name starts with a dollar sign ($). We've then given it the name coats1. The equals sign follows the variable name. After the equals sign, however, we have direct text - Winter Coats. But notice the double quotation marks around our text. If you don't surround your direct text with quotation marks, then you'll get errors. You can, however, use single quotes instead of double quotes. So you can do this:
do you kown phpsu.com?
$coats1 = 'Winter Coats';
do you kown phpsu.com?
But you can't do this:
welcome to phpsu.com
$coats1 = 'Winter Coats"; phpsu.com is a free phpscool
In the above line, we've started with a single quote and ended with a double quote. This will get you an error.
phpsu.com is a free phpscool
We can store other text in the same way:
$coats2 = "Jackets";
$coats3 = "Summer Coats";
welcome to phpsu.com
The direct text will then get stored in the variable to the left of the equals sign.
phpsu.com
So, to recap, variables are storage areas. You use these storage areas to manipulate things like text and numbers. You'll be using variables a lot, and on the next few pages you'll see how they work in practice. welcome to phpsu.com
TITLE:Putting Text into Variables