print() function in PHP || PHP print() function

print() function in php

Last Updated by Pooja Chikara 18-May-20

0 236


PHP print() function is used to output one or more strings. It is an inbuilt function of PHP. The working of the print() is the same as the working of echo() function but it is slower than echo() function.

The return type of this function is a string.

Syntax:

print($string);

In case of more than one string, use this function without parenthesis.

print $string1.$string2;

here,

$string, $string1 and $string2 are PHP strings


Example 1:

<?php
$string="Welcome to Coding Tag";
print($string);
?>

Output:

print() function in php


Example 2:

<?php
$string1="Welcome to ";
$string2="Coding Tag";
print $string1.$string2;
?>

Output:

print() function in php


Share:


Leave a Reply


Comments
    Waiting for your comments