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 beforeRender() used?
Why do we need session?
How can we define a variable accessible in functions of a php script?
Why are sessions used?
What is a substring in php?
What is the use of 'print' in php?
Explain php split() function.
Explain soundex() and metaphone().
What is helper function?
What is artisan in php?
What are the disadvantages of php?
How can we display information of a variable and readable by a human with php?
What is the difference between query and question?
How to calculate the length of a string?
Explain me what is the difference between $_files['userfile']['name'] and $_files['userfile']['tmp_name']?