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 mysqli php?
Why shouldn't I use mysql_* functions in php?
What is php and why it is used?
How is the comparison of objects done in php?
Which cryptographic extension provide generation and verification of digital signatures?
What's the best method for sanitizing user input with php?
Tell me how is it possible to know the number of rows returned in result set?
What are the benefits of using queries?
What is $_ request in php?
How can php and html interact?
Explain some of the php string functions?
What is the use of pear in php?
How is it possible to know the number of rows returned in result set?
How many types of array are there in php?
Tell me what is the difference between the functions strstr() and stristr()?