代码示例:(标识:demo_php_print2)
<!DOCTYPE html>
<html>
<body>

<?php
$txt1="Learn PHP";
$txt2="sou-xun.com";
$cars=array("Volvo","BMW","SAAB");
print $txt1;
print "<br>";
print "Study PHP at $txt2";
print "<br>";
print "My car is a {$cars[0]}";
?>

</body>
</html>
运行结果: