Saturday, December 31, 2016

Difference Between echo and print statements - PHP tutorial - Web development

echo and print - Output statements in php

                                 echo and print statement are merely same. Both are used to output in php. Difference between echo and print is an echo statement has no return value print statement has return value.

echo and print statement can be used with or without parenthesis echo or echo() and print or print(). 

example of echo and print statement :

echo "text".$variable;

print "Text".$variable;


example with echo and print statement below:


<!DOCTYPE html>
<html>
<body>

<?php
$x=10;
echo "<p>The value of x is".$x."</p>";
$returnval = print "<p>The value of x square is".$x*$x."</p>";
print "<p>The Return Value of print is".$returnval."</p>";
?>

</body>
</html>


Output of the above program:


Keep reading our blog to learn php free!. Thank you Readers.


Please Note:-

We are serving to our blog readers to post ad free for their business development. And educating them to develop their own website.

Please check our free websites and blogs. 

I am using php script for my website to post free ads - Please click the link and check it out 
http://www.freeadsimple.com

To Learn Basic HTML Please Read the article from http://webdevelopmentstepbystep.blogspot.com






1 comment: