PHP print() Function

PHP parse_str() Function
PHP printf() Function

what is the syntax of the pRINT() function in php?

print(strings)
ParameterDescription
stringsRequired. One or more strings to be sent to the output

examples of the pRINT() function

Examples 1. In this example, we write some text to the output.

<?php
print "Hello world!";
?>

Examples 2. In this example, we write the value of the string variable ($str) to the output, including HTML tags:

<?php
$str = "Hello world!";
print $str;
?>

Examples 3. In this example, we write the value of the string variable ($str) to the output, including HTML tags:

<?php
$str = "Hello world!";
print $str;
print "<br>What a nice day!";
?>

Examples 4. In this example, we join two string variables together:

<?php
$str1="Hello world!";
$str2="What a nice day!";
print $str1 . " " . $str2;
?> 

Examples 5. In this example, we write the value of an array to the output:

<?php
$age=array("Peter"=>"35");
print "Peter is " . $age['Peter'] . " years old.";
?>

Examples 6. In this example, we Write some text to the output:

<?php
print "This text
spans multiple
lines.";
?> 
PHP parse_str() Function
PHP printf() Function
en English
X
Scroll to Top