PHP echo and print


title: Echo and Print

Echo and Print

The echo and print functions provide a way to write out the value of a variable or argument to the screen.

echo

The echo() function writes out the value of a variable or argument to the screen.

<?php echo "Codevarsity";

NOTE: A short hand way to open the PHP tag and echo is <?=

<?= "Codevarsity"; ?>

print

The print() function out the value of a variable or argument to the screen.

<?php print "Codevarsity";

print_r

The print_r() function writes out the value of any variable (such as an array) or argument to the screen, unlike the echo or print functions which are more limited.

<?php $Codevarsity = "Codevarsity"; print_r($Codevarsity);

More Information:

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.