Home >>PHP String Functions >PHP echo() Function
PHP echo() function is a statement i.e used to display the output.
This echo() function can be used with parentheses echo or without parentheses echo.
In echo() function we can pass multiple string separated as ( , ).
The echo() function doesn't return any value like the print() function but echo() is little faster then print().
Syntax :
echo (argument1, argument2, ... );
Let's see some example of echo() function:
<?php $name="John"; echo $name; //or echo ($name); ?>
We can also pass multiple arguments in echo():
<?php $name = "John"; $profile = "PHP Developer"; $age = 25; echo $name ." ". $profile ." ". $age ." "." years old"; ?>
We can also print the elements of an array using the echo():
<html> <body> <?php $a=array("0"=>"PHP","1"=>"Python"); print "We love " . $a['0'] . " & ".$a['1']." also."; ?> </body> </html>