What is the Diff. Between echo() and Print() in PHP?
Answer Posted / vinay sachan
There are many differences in print() and echo() :-
1-echo is unformatted whereas print is formatted.
2-echo() can take multiple expressions, Print cannot take multiple expressions.
ex.-
<?php
$name="Vinay";
echo "Name is $name";
//Value is Vinay
print 'Name is $name';
//Value is $name
?>
3-Print return true or false based on success or failure whereas echo just does what its told without letting you know whether or not it worked properly.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is filter_var?
What are some new features introduced in php7?
Can php variables have numbers?
Is facebook still written in php?
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what is the problem?
What is the use of return in php?
What are the characteristics of php variables?
How many types of session are there?
What is PHP? Who is the father or inventor of PHP?
Is php faster than javascript?
What is cms php?
What is the difference between implode() and explode() in php?
How to get useful error messages in php?
What is the function file_get_contents() useful for?
Differentiate between require and include?