PHP echo and print Statements

 In PHP echo and print are both used for output the data to the screen. The echo and print statements, are not function but are language constructs. 

The difference between echo and print are small : echo has no return value while print has a return value 1.  so it can be used in expression. 

echo can take multiple parameters while print can take one parameters. 

echo is marginally faster tha print.

echo Statement -

the echo statement can be used with or without  parentheses echo or echo ().

<?php

echo "<h2>PHP is Fun!</h2>";

echo "Hello world!<br>";

echo "I'm about to learn PHP!<br>";

echo "This ", "string ", "was ", "made ", "with multiple parameters.";

echo ("This ", "string ", "was ", "made ", "with multiple parameters.");

?> 


print statement -

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

<?php
$txt1 = "Learn PHP";
$txt2 = "wartalab.blogspot.com";
$x = 5;
$y = 4;

print "<h2>" . $txt1 . "</h2>";
print "Study PHP at " . $txt2 . "<br>";
print $x + $y;
?>

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...