WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP 5 echo and print Statements


In PHP there are two essential sorts to get yield: reverberation and print.


PHP reverberation and print Statements

echo and print are pretty much the equivalent. They are both used to yield information to the screen.

The contrasts are little: reverberation has no arrival esteem while print has an arrival estimation of 1 so it very well may be utilized in articulations. reverberation can take different parameters (albeit such utilization is uncommon) while print can take one contention. reverberation is insignificantly quicker than print.


The PHP reverberation Statement

The reverberation explanation can be utilized with or without enclosures: reverberation or echo().

Display Text

The following model tells the best way to yield content with the reverberation direction (see that the content can contain HTML markup):

Example

<?php
reverberation "<h2>PHP is Fun!</h2>";
reverberation "Hello world!<br>";
echo "I'm going to learn PHP!<br>";
reverberation "This ", "string ", "was ", "made ", "with various parameters.";
?>

Display Variables

The following precedent tells the best way to yield content and factors with the reverberation statement:

Example

<?php
$txt1 = "Learn PHP";
$txt2 = "welookups.com";
$x = 3;
$y = 2;

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

The PHP print Statement

The print explanation can be utilized with or without enclosures: print or print().

Display Text

The following model tells the best way to yield content with the print order (see that the content can contain HTML markup):

Example

<?php
print "<h2>PHP is Easy!</h2>";
print "Hello world!<br>";
print "I'm going to learn PHP!";
?>

Display Variables

The following precedent tells the best way to yield content and factors with the print statement:

Example

<?php
$txt1 = "Learn PHP";
$txt2 = "welookups.com";
$x = 3;
$y = 2;

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