Echoing a String : Echo « Development « PHP






Echoing a String

<html>
<head>
<title>Echo Example</title>
</head>
<body>
<?php
     $string1 = "A.<br />\n";
     $string2 = "B ";
     $string3 = "Line 1
spans multiple lines.
Line3<br />";
   
     echo "Start, ", $string2, $string1;
     echo("$string2$string1");
     echo("This string $string1");

     echo($string2 . $string1);
     echo($string3);
     echo "Line 1.
lin 2!!<br />";
?>

<?=$string2,$string1?>

<?="output", " java2s.com!", "<br />", ":-)", "<br />\n" ?>

<?="This string
spans multiple lines.
Even the newlines are output in the document source!<br />"?>

</body>

</html>
           
       








Related examples in the same category

1.Echo multiline string
2.Use Echo command to output HTML string
3.Echo variables
4.Use Echo to output string
5.Escape the inner quotation marks by placing a backslash before each one
6.Use echo command to output HTML