PHP Echo-Print
PHP ECHO & PRINT
WHAT IS ECHO IN PHP?HOW TO USE ECHO IN PHP?SYNTAX OF ECHO?
WHAT IS PRINT IN PHP?
HOW WE USE PRINT IN PHP?
SYNTAX OF PRINT?
ECHO IN PHP
Well echo in PHP have crucial importance as in other languages some syntax is used to display values. In PHP, echo is used to display the values. We also say to print a value in a program or PHP script used echo. Echo cannot return any values it just displays output to the browser.
HOW TO USE ECHO IN PHP
Echo is used simply in PHP for both displaying text, HTML elements, variables and both variables with HTML element.
HOW TO DISPLAY/ECHO TEXT IN PHP: echo "Welcome To Worldviewit";
HOW TO DISPLAY/ECHO HTML ELEMENT: echo "<p>
Welcome To WORLDVIEWIT </p>";
HOW TO DISPLAY/ECHO PHP VARIABLE: echo $a;
HOW TO ECHO BOTH VARIABLE WITH HTML ELEMENT: echo " <p>
" . $a . " ";
ECHO SYNTAX EXAMPLE
//displaying text
echo "Welcome To WORLDVIEWIT";
//displaying html element
echo "<p>Welcome To WORLDVIEWIT</p>
“;//assigning a value to variable
$a=10;
//displaying a varaible
echo $a;
//both html & php variable concatenate
echo "<p>
WELCOME TO WORLDVIEWIT ” . $a . “</p>";
?>
OUTPUT
WELCOME TO WORLDVIEWIT
WELCOME TO WORLDVIEWIT
10
WELCOME TO WORLDVIEWIT 10
WHAT IS PRINT IN PHP
Print is another method to get/display the output on the screen. And moreover print return value of 1. It is mostly used for expression. It only takes one value in it. You can also use it with or without parentheses.
HOW WE USE PRINT IN PHP
1) print "<p> Welcome To WORLDVIEWIT</p>";
2) print "WELCOME AND ENJOY HERE<br>";
$a= "WORLDVIEWIT";
3) print "Welccome To" . $a ;
4) print $a;
SYNTAX OF PRINT
<?php
//display html element
print "<p> Welcome To WORLDVIEWIT</p>";
print "WELCOME AND ENJOY HERE";
$a = "WORLDVIEWIT";
print "Welcome To" . $a;
print $a;
?>
OUTPUT
Welcome To WORLDVIEWIT
WELCOME AND ENJOY HERE
Welcome To WORLDVIEWIT
WORLDVIEWIT
Recent Posts
- Comparing Top Insurance Apps: Features that Matter Most
- Stay Protected Anywhere: The Convenience of Mobile Insurance with AXA
- Why Every Driver Needs the State Farm Mobile App Today
- Maximize Your Auto Coverage with GEICO’s Innovative Mobile Solutions
- Rev Up Your Savings: How Aviva Drive Redefines Car Insurance
- Unlocking Peace of Mind: Allianz Insurance Coverage Explained
- Top 5 Mobile Apps for Hassle-Free Car Insurance Management
- Google is turning Android Phones into seismometers
- Introduction of CSS
- PHP While Loops