<?php $like = "I like About"; print $like; $num = 12345; print $num; ?>
This sets our variable, $like, to our previous I like About statement. Notice again the quotation marks [ââ] used, as well as the semicolon [;] to show the end of the statement. The second variable $num is an integer, and therefore does not use the quotation marks. The next line prints out the variable $like and $num respectively. You can print more than one variable on a line using a period [.], for example:
<?php $like = "I like About"; $num = 12345; print $like . $num; print "<p>"; print $like . " " . $num; print "<p>"; print "My favorite number is $num"; ?>
This shows two examples of printing more than one thing. The first print line prints the $like and $num variables, with the period [.] to separate them. The third print line prints the $like variable, a blank space, and the $num variable, all separated with periods. The fifth line also demonstrates how a variable can be used within the quotation marks [""].
A few things to remember when working with variables: they are CaSe SeNsitiVe, they are always defined with a $, and they must start with a letter or an underscore (not a number.) Also note that if needed you can dynamically build variables. For a more thorough look at variables, see our Guide to Variables.