PHP is giving some sting functions to printing output into browser and we are often using print() and echo() function. Both of those functions are not real function but a language construction. print() and echo() function have same goal, but there are some essential different that must to pay attention.
Print() function behavior like the other function in common and having return value integer 1. Thus, print() can used as part of expression which more complex. Meanwhile, echo() is able to accept more than one parameters all at once, and does not having return value.
print() ‘string 1’;
echo ‘string 1’;
// using some parameters
echo ‘string 1’, “string 2”, ‘…’;
echo() function string will execution more faster than print(). This differentiate caused by will return status (integer) which expose what process has done or not.
On the other side, echo() just displaying output only and do anything. At implementation, return value status from using function string almost never needed.
Print Output
