How to use echo in PHP

In this article, I will explain how the echo() function can be used in PHP.
  • 1225

echo() function in PHP

  • The echo() function is used to output one or more strings.
  • In echo() function, you are not required to use parentheses with it.
  • The echo() function will generate a parse error, if you want to pass more than one parameter to echo().

Syntax

echo(string)

Parameter

  • string string is required parameter. one or more string can be used to be output.

Example

The following example show to how the echo() function can be used in PHP.

 <html>

<body>

<h3 style="color: gray;">echo() function example in PHP</h3>

   <?php

    $string = "C-sharpcorner";

    echo $string;

    echo "<br />";

    echo $string."<br />Welcome to all user's....";

    ?>

</body>

</html>

 

Output

echophp.jpg
You may also want to read these related articles here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.