echo() function in PHP || PHP echo function

echo() function in php

Last Updated by Pooja Chikara 01-May-20

0 341


PHP echo() function is used to get the output of regular expression or print strings in PHP. It is an inbuilt function in PHP. The working of this function is the same as print() function but it is faster than print().

Note:

This function can be used without parenthesis in the case to outputs more than one strings.

Syntax:

echo($str);
or
echo $str1.$str2.$strN;

here,

$str, $str1, $str2 and $strN are PHP strings.


Example 1:

<?php
$str="Welcome to Coding Tag.";
echo($str);
?>

Example 2:

In the case of multiple strings we use this function without parenthesis.

?php
$str1="Delhi is the capital of India.";
$str2="It has so many tourist places";
echo $str1.$str2;
?>

Output:

echo() function in php


Share:


Leave a Reply


Comments
    Waiting for your comments