PHP Echo and Print

  • الكاتب Mya
  • تاريخ اﻹضافة 2017-02-26
  • مشاهدة 9

Examples explained how "display strings with  the echo command,"display strings and variables with the echo","display strings  with the print  command","display strings and variables with print  command


* Display strings with  the echo command :


<html>
<body>

<?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.";
?>
 
</body>

</html>


* Display strings and variables with the echo :


<html>
<body>

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

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

</body>
</html>


* Display strings  with the print  command :

<html>
<body>

<?php
print "<h2>PHP is Fun!</h2>"
;
print "Hello world!<br>"
;
print "I'm about to learn PHP!";
?>
 
</body>
</html>


 :Display strings and variables with print  command *

<html>
<body>

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

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

</body>
</html>


شارك هذا الموضوع

آراء الأعضاء

الأوسمة

مواضيع مميزة