PHP echo Function
The PHP echo Function is used to print a text output to the screen.You can use it in an html tag inside the echo command.
You can combine more than one variable and print it on the screen with the echo command.
echo (value)
<?php
// Example use of an echo command
echo "Hello friends";
?>
<?php
//Using html tag inside the echo command
$string = "Hello friends";
echo $string;
echo "<br>I am learning php";
?>
<?php
//echo by combining multiple variables
$string1="Hello";
$string2="How are you";
echo $string1 . " " . $string2;
// It is the point joining operator. It allowed us to make value1 + html tag + value2.
?>
<?php
//Using variables in text in php
$araba=array("mercedes"=>"benz");
echo "My car " . $araba['mercedes'] . " model.";
?>
<?php
//In php echo, passing the bottom line in the code block does not affect the result, so you can use the <br> tag.
echo "Inside the label
get to the bottom line
Doesn't mean anything";
?>
<?php
// echo single quote double quote difference
$blue = "blue";
echo "this car $blue";
echo "<br>";
echo 'this car $blue';
?>
<?php
// echo short use
$color = "blue";
?>
<p>This Car <?=$color;?> color.</p>
Php echo is not actually a function, so you can use () without parentheses. It differs from the echo print_r function. When you use print_r it shows all values in the array.When you want to reach an article, using echo allows you to process faster.