PHP - PHP Echo


PHP echo is a language construct not an organization, as a result, you don't compulsion to use parenthesis following it. But if you longing to use more than one parameter, it is required to use parenthesis.

 

The syntax of PHP echo is given below:

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

PHP echo upholding can be used to print a string, multi heritage strings, escaping characters, adaptable, array, etc.

Let's take an example "echo" that is used to print a string:

 

PHP echo: Single line printing on Screen

<?php  
echo "Hello by PHP echo - by Tutorials Wave";  
?>  

This above line will print a string onto the user screen :

The output of the above code :

Hello by PHP echo

 

PHP echo: Multiline printing on Screen

The below code will print a string in multiline format

<?php
  
echo "Hello by PHP echo  
this is multi line  
text printed by   
PHP echo statement - Powered by Tutorials Wave";  


?>  

The output of the above code is :

Hello by PHP echo  
this is multi line  
text printed by   
PHP echo statement - Powered by Tutorials Wave

 

PHP echo: printing escaping characters

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

The output of the above code :

Hello escape "sequence" characters

 

PHP echo: printing variable value

<?php  
$msg="Hello this is Tutorials Wave";  
echo "Message is: $msg";    
?>  

 

The output of the above code :

Message is: Hello this is Tutorials Wave

 

 

<< Prevoius Next >>