Print/echo statement
(1) Like python or other programming language, Print in PHP or echo in PHP does the same job i.e printing the statement on the screen
Example
<?php
print "This is php script";
echo " This is php script";
?>
This is php script
This is php script
So it is obvious from the above code, it just print the same character as it is and it is quite simple to use.
(2) Just like any other programming language , print statement print the variable name in the same manner as given below
<?php $x=10 print "This is $x"; echo " This is $x"; ?> This is 10 This is 10
(3) The behavior with single quotes is different
<?php $x=10 print 'This is $x'; echo "This is $x"; ?> This is $x This is 10
So if you enclose the statement in single quotes, variable are not substituted for their value and they are printed as just they are word.
(4) PHP Array can be printed as below
<?php $oracle_product = array("hyperion", "database", "weblogic", "sql", "EBS"); foreach($oracle_product as $value){ echo $value . "<br>"; } ?>
So you basically iterate through the array using for loop and print the each element in the array. This is quite useful
Hope you like post on print in PHP
Also Reads
How to run php file in windows : This post talks about how we can php file on the the window and do the testing before moving to the web server
uses of PHP : This has detailed description why PHP is so much used through out the world.
first php program : This is good starting point for anybody starting with PHP and talk in good detail about how to write your PHP program and execute it
Define constant in PHP
PHP Array functions
PHP String Functions
https://en.wikipedia.org/wiki/PHP