PHP Variable
In the last PHP Lesson we learned how to echo out a line of text in a browser in this lesson we will learn about a #php variable. A variable in php stores information. In the example below we see that a variable starts with a $ sign and is followed by text.
<?php $name ="My name is Max" ?>In the example above we see a very simple php variable structure. This code in itself will show nothing in a browser because we have not echoed anything so in order for it to show in the browser we would have to echo it out like in the example below.
<?php $name ="My name is Max"; echo $name; ?>Try it for yourself in the PHP code pad below provided by proose.com . Just highlight all the text that you see in the box and click backspace to put in your PHP Variable.
![PHP Variable](https://a1websitepro.com/uploads/2013/03/phpedits.png)
![PHP Variable](https://a1websitepro.com/uploads/2013/03/phpedit2.png)
Simple right? Ok well let's include some line breaks like we learned before. A line break is a HTML code, and it tells the browser that we want to start a new line. We learned this in our previous PHP lesson. So let's try this code in our PHP fiddle.
<?php $variable ="Hello my name is Max I work at A1WebsitePro.com<br/> A1WebsitePro.com is the #1 Web Development company in the world<br/> Contact them today if you are serious about having a top notch website"; echo $variable; ?>Another great thing about PHP is that you can do math with it. Check out this code below.
<?php $two = 2; $three=3; echo $two + $three; ?>