PHP Echo

PHP Echo

PHP echo is a language construct not a function, so you don't need to use parenthesis with it. But if you want to use more than one parameters, it is required to use parenthesis.
The syntax of PHP echo is given below :

void echo ( string $arg1 [, string $... ] )

PHP echo statement can be used to print string, multi line strings, escaping characters, variable, array etc.


PHP echo: Printing String

<?php
	echo "Hello W3professors";  
?>  
Output : Hello W3professors

PHP echo: Printing Multi Line String


<?php  
    echo "this is a example of 
	multi line   
    PHP echo statement  
    ";  
?>  

Output : this is a example of multi line PHP echo statement

PHP echo: Printing Escaping Characters

    <?php  
    echo "Hello escape \"sequence\" characters";  
    ?>  
Output : Hello escape "sequence" characters

PHP echo: printing variable value

 <?php  
    $msg="Thanks to Visit w3professors.com";  
    echo "Message : $msg";    
    ?>  
Message : Thanks to Visit w3professors.com