PHP BasicIntroduction to PHP PHP Starting Requirements Downloading XAMPP Local Server PHP Variable Concept and Data Type PHP Coding Syntax Showing Output in PHP PHP String Concatenation Increment & Decrement in PHP PHP Logical Operator and Usage Part-1 PHP Logical Operator and Usage Part-2 PHP Comparison Operators Arithmetic and Assignment Operators PHP Switch Case Statement For loop in PHP Super Global Variable $_REQUEST and $_GET Part-1 String Length in PHP Function Declaration and Usage
PHP has a system for showing a result. This is done by echo. We can easily print value directly or the value of a variable by using echo. echo can print data or values anywhere of php code. It can be used inside function, class etc. Like other programming languages such as C or Java; PHP has also use built in function for showing a value. PHP has print_r(), print(), printf() function. Most of the time these functions are not used. print_r function is used to show array date during development. It has not used to show data. print() function is used to format a string in a different way. printf() function does the same work as print(); echo is used widely in PHP programming by developers and coders also. The main advantage of this echo is that it can print any type of variable like string, float, double, bool, int etc. Let's see an example below for better clearance.
<?php echo 'We are learning php today'; ?>
We are learning php today
<?php $NUM = 50; echo $NUM; ?>
Anyone can easily print value by using this awesome echo that is available by php.