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

print() function in php

Last Updated by Pooja Chikara

0 2295

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:


Example 2:

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

Output:




Best WordPress Hosting


Share:

SSL for business, from $12.88


Leave a Reply


Comments
    Waiting for your comments

Coding Tag WhatsApp Chat
Coding Tag WhatsApp Chat