PHP Display Variables

In PHP the two most common output variables are echo and print. They are used to display. Values can be from a SQL database or any custom generated value as per application requirement. 


$txt1 = "Open Learning";
$txt2 = "";

$o = 5;
$c = 4;

print "<b>" . $txt1 . "</b><br>";

print "Learn PHP from " . $txt2 . "<br>";

echo "Sum of ".$o ." and ". $c ." is ".($o+$c); ?>

Output is as follows:

Open Learning
Learn PHP from
Sum of 5 and 4 is 9

Related Tutorials