Php Output (echo/print)
We all know the after execution of particulars script we want some output to be shown on the screen , yes this is possible by the two primary methods echo and print. But there are some advanced methods which we will go through later part.
Both the method outputs the data but there is small difference between echo and print.
echo : Does not have a return value and can can take multiple parameters.
print: Returns 1 after the execution and can take only single parameter.
So the conclusion defines that echo is much faster than print.
Lets move to example an example how to echo something on the screen
<?php
$first_val = 1200;
$second_val = 800;
echo $first_val + $second_val;
?>
Output : 2000Note : The echo and print statements can be used with or without parentheses.
No comments:
Post a Comment