Sei sulla pagina 1di 8

Home | Ask Question | Interview Questions | Tech FAQs | Engineering | Company | Geek Forums | Interview Coaching | Online Quiz

| Interview eBook
Home Home Interview Questions Interview Questions Programming Programming PHP PHP
Question: 77 of 98
If anyboyd knows, do tell me.
waiting for your prompt response.
First Previous Next Last
Return back to PHP Return back to PHP Answer Question Answer Question
Showing Answers 1 - 42 of 42 Answers Showing Answers 1 - 42 of 42 Answers
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Venu Gopal.M
Answered On : Sep 28th, 2006
Hi,
echo is a construct.echo takes multiple parameters
print is also a construct but print does not take multiple parameters
Ramesh
Answered On : Oct 4th, 2006
Hi,
echo :-
- Is a command only.
- Faster than Print.
print
-
Ramesh
Answered On : Oct 4th, 2006
Hi,
echo:-
- Is a command only.
- Faster than print
print:-
- Is a function.
- It will return true(1) or false(0) or some values.
Mahendra Choudhary
Answered On : Oct 12th, 2006
Main difference between echo() and print() is that echo is just an statement not a function and doesn't
return's value or it just prints a value whereas print() is an function which prints a value and also it
returns value.
rashmi
What is the difference between echo and print?
Asked by: Interview Candidate | Asked on: Sep 25th, 2006
User User Panel Panel
Register
Login
Lost Password
Get Activation Code
Categories Categories
Algorithms
ColdFusion
Computer Awareness
Delphi
Perl
PHP
Python
VBA
VoiceXML
XML
Interview Coaching Interview Coaching
Have you experienced being
given too many tasks?
How do you handle pressure
and stress?
Describe a time when you had
to convince a friend ?
What are my options when I
do not get a job after
graduation?
Has anyone asked you for
help? What did you do?
What do you do when things
do not go as planned? Cite an
example.
Do you have any questions
that you want to ask?
Does a problem make you a
better person?
How productive are you?
What do you think about our
company?

Your Question...
GO
Ads Ads
Connect Connect
Ads Ads
Interview Interview Question Question
Ask Interview Question?

Career Career Counselling Counselling
Have Career Question?
Series: Series: Subject: Subject: Topic: Topic:
What is the difference between echo and print? http://www.geekinterview.com/question_details/35222
1 of 8 13-09-2012 23:04
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
1 User has rated as useful. Login to rate this answer.

Answer Question Answer Question
1 User has rated as useful. Login to rate this answer.

Answer Question Answer Question
Login to rate this answer.
Answered On : Nov 2nd, 2006
echo is a statement and print is a function.
Bhupal
Answered On : Nov 4th, 2006
Echo and Print are used for the same functionality printing of data.But there is echo is not a function we
cannot pass arguments ,where as print is a function we can pass arguments .Thank you,Bye.
anas
Answered On : Nov 9th, 2006
hi .i am anas.i am also preparing for PHP .basically diff. of echo and print is echo have multiple
arguments and in print function have only one argument.
Mohamed
Answered On : Dec 13th, 2006
echo is a statement an does not return valueprint is a function and returns value
ankita
Answered On : Dec 15th, 2006
print can be used as part of a more complex expression where echo cannot.echo is marginally faster
since it doesn't set a return value.
Raj
Answered On : Dec 21st, 2006
echo : just output the content
print : it returns true for successful output and false for unsuccessful
Bhumita
Answered On : Dec 22nd, 2006
Well I have found 3 major differences between echo and print:
Echo:
1) Does not return value.
2) Faster than 'print'.
3) Can take multiple arguments.
Print:
1) It returns value.
2) Slower than 'echo'.
3) Cannot take multiple arguments.
Anand
Answered On : Dec 28th, 2006
print function always returns 1.
echo statement will not return anything.
u can execute echo "Anand","mohan"; but not print("Anand","mohan"); or print"Anand","mohan";
Thanks
Anand
Your Question...
GO
Ask Chandra
Ask Only Career questions.
Follow us:

Latest Latest Questions Questions
Configure log4php
Ads Ads
Interview & Interview & Career Tips Career Tips
Get invaluable Interview and Career Tips delivered
directly to your inbox. Get your news alert set up
today, click "Subscribe".
What is the difference between echo and print? http://www.geekinterview.com/question_details/35222
2 of 8 13-09-2012 23:04
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
1 User has rated as useful. Login to rate this answer.

Answer Question Answer Question
Login to rate this answer.
bhoomika
Answered On : Feb 5th, 2007
print is a function and returns true or false value where as echo is a command only...
hari krishnan
Answered On : Feb 16th, 2007
echo() can take multiple expressions,Print cannot take multiple expressions.echo has the slight
performance advantage because it doesn't have a return value.True, echo is a little bit faster
maurani
Answered On : May 5th, 2008
echo() can take multiple expression bt print() cant
sandep_dcte
Answered On : May 29th, 2008
echo is not a function but print is a function echo is alias
echo can accept multiple argument
geek_sport
Answered On : May 31st, 2008
Here is the complete detailed explanation. The third point is the most important.
1. Speed. There is a difference between the two, but speed-wise it should be irrelevant which one you
use. echo is marginally faster since it doesn't set a return value if you really want to get down to the nitty
gritty.
2. Expression. print() behaves like a function in that you can do:
$ret = print "Hello World";
And $ret will be 1. That means that print can be used as part of a more complex expression where echo
cannot. An example from the PHP Manual:
$b ? print "true" : print "false";
print is also part of the precedence table which it needs to be if it is to be used within a complex
expression. It is just about at the bottom of the precedence list though. Only "," AND, OR and XOR are
lower.
3. Parameter(s). The grammar is:
echo expression [, expression[,expression] ... ]
But echo ( expression, expression ) is not valid.
This would be valid: echo ("howdy"),("partner"); the same as: echo "howdy","partner"; (Putting the
brackets in that simple example serves no purpose since there is no operator precedence issue with a
single term like that.)
So, echo without parentheses can take multiple parameters, which get concatenated:
echo "and a ", 1, 2, 3; // comma-separated without parentheses
echo ("and a 123"); // just one parameter with parentheses
print() can only take one parameter:
print ("and a 123");
What is the difference between echo and print? http://www.geekinterview.com/question_details/35222
3 of 8 13-09-2012 23:04
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
print "and a 123";
sheeku
Answered On : Mar 6th, 2009
The major differences between print and echo are:
1) echo is a language construct while print is a function
2) echo can take multiple parameters while print can't take multiple parameters
3) echo just outputs the contents to screen while print returns true on successful output and false if
enable to output.
In this sense we usually says that print returns value while echo don't
4) echo is faster
than print in execution because it does not return values.
SwapnilSwapnil
Answered On : Sep 7th, 2009
You are unlikely to ever want to know this, however the difference is that print will return a value to let
you know if the statement worked or not, whereas trying the same thing with echo will result in error:
<?php
echo "Please don't make me say it... n";
$you = print "Hello World!n";
echo "Returning $you"; //Returning 1, assuming the print worked
?>
Joni Rajput
Answered On : May 12th, 2011
1. echo allows more than one parameters using coma operator, while print does not allow.
2. echo is slightly faster than print.
3. echo does not return any value , while print returns.
Jim Tyson
Answered On : May 21st, 2011
One is a function the other a statement. The function
print();
returns a Boolean value and has a side effect (it displays the value of it's argument). The statement
echo "";
has a side effect but is not evaluated and returns no value.
In at least some tests echo has been clocked as marginally faster. This means that you can test the
outcome of print() but you cannot directly test the success or otherwise of echo.
krbhupinder
Answered On : May 23rd, 2011
these 2 have same meaning.
What is the difference between echo and print? http://www.geekinterview.com/question_details/35222
4 of 8 13-09-2012 23:04
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Janaki Pusapati
Answered On : Jul 6th, 2011
Both are output statements, Both are language constructs, print returns a value. require parenthesis.
echo accept multiply argument, echo give u same output, echo doesn't return anything and it is like a tag
print always return a integer value 1.
Mohd Shoeb
Answered On : Jul 13th, 2011
echo is the most primitive than print, and just output the content following the construct to the screen.
print is also a construct (so parameter are optional when calling it), but it returns TRUE on successful
output and FALSE, if it was unable to printout the string. However you can pass multiple parameters to
echo(). echo is faster than print
the basic difference between echo() and print() are-
1. echo is just like a command and print() is a function.
2. print always returns the value in 1(true) or 0(false),
3. prints supports a single statement and echo supports a multiple statement
4. echo parsed reference variable on the other hand print doesn't
san
Answered On : Jul 15th, 2011
both are used in php as output Streams.

Code
<?php 1.
2.
print( "my india") ; 3.
?> 4.
or 5.
<?php 6.
echo "my india" 7.
?> 8.
san
Answered On : Jul 15th, 2011
echo is faster than print....echo can execute more than 1 statements but print does not execute more
than 1 statements.. It can execute only a single statement....
Code
?php> 1.
$sname="San", "tosh"; 2.
echo( "San", "tosh") ; 3.
print( "San") ; 4.
?> 5.
gautam
Answered On : Jul 27th, 2011
echo prints many values at a time
echo "first","second","third";
output:-
firstsecondthird
print() prints only one value i.e. its attribute
What is the difference between echo and print? http://www.geekinterview.com/question_details/35222
5 of 8 13-09-2012 23:04
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
gautam
Answered On : Jul 27th, 2011
echo prints multiple values
print () only one value
Heer Makwana
Answered On : Jul 30th, 2011
Print will return TRUE/FALSE value while Echo doesn't return value and is little bit faster than Print.
Jim Tyson
Answered On : Aug 1st, 2011
Sorry, this code confuses me. Code I can't work out what the value of $sname will be after line 2. You
can't use a list like this in an assignment statement. Do you think the value of $sname should be "San" or
"tosh"? Why having initialised $sname do you use string literals in the following statements? Finally
again: print is a function - it returns success or failure with the display of the arguments as its side effect;
echo is a construct with no return value and only the side effects - *and* echo can take multiple
parameters.
Code
1.
1 . 2.
?php> 3.
2 . 4.
$sname="San", "tosh"; 5.
3 . 6.
echo( "San", "tosh") ; 7.
4 . 8.
print( "San") ; 9.
5 . 10.
?> 11 .
pardeep khot
Answered On : Aug 31st, 2011
echo is marginal faster than the print.
print behaves like a function but echo does not.
print take multiple argument but echo does not.
sudhasri7777
Answered On : Sep 5th, 2011
echo
No return value
Outputs one or more strings separated by commas
e.g. echo "String 1", "String 2"
print
Returns 1, so it can be used in an expression
Outputs only a single string
e.g. if ((print "foo") && (print "bar"))
santosh srinivas
Answered On : Sep 9th, 2011
echo can print multiple lines at time,but in case of print it will execute single line......
What is the difference between echo and print? http://www.geekinterview.com/question_details/35222
6 of 8 13-09-2012 23:04
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
Answer Question Answer Question
Login to rate this answer.
abc
Answered On : Sep 12th, 2011
php syntax same as that of perl & C..so echo used for printing in php and print in C
kumaran
Answered On : Nov 14th, 2011
using print method can return a true/false value. This may be helpful during a script execution of some
sort. Echo does not return a value, but has been considered as a faster executed command.
kanchan bhardwaj
Answered On : Dec 9th, 2011
Echo- it is a command only and faster than print
Print-it is a functon & it will return true or false or some values.
sabareesh
Answered On : Jan 2nd, 2012
Main difference between echo() and print() is that echo is simply a statement not a function which
cannot returns the value but just print the statement where as print is a function which can print and
return the value. We cannot pass argument to the echo because it is a statement where as we can pass
argument to print because it is a function and it returns true or false values.
ganeshpapde
Answered On : Feb 21st, 2012
echo or print r d functions ....echo is mostly we r using in php
Premjith
Answered On : Mar 21st, 2012
Both are language constructs. print behaves like a function and return value but actually it is not a
function. echo never returns value
echo with out parenthesis takes multiple arguments print doesn't takes multiple arguments separated by
commas
vetrivel .s
Answered On : Apr 19th, 2012
Echo and print both are same.. mostly the developer using echo because it is execution speed faster than
print...
ganta srinivasarao
Answered On : Aug 17th, 2012
echo is a construct but print is a function. we can print two or more variables with help of echo but with
help of print function only one..
Abhyuday kumar rai
Answered On : Aug 31st, 2012
echo:- print:-
a)can accept multiple parameters. a)cant accept multiple parameters.
b)doesnt return any value. b)slower than echo.
What is the difference between echo and print? http://www.geekinterview.com/question_details/35222
7 of 8 13-09-2012 23:04
Answer Question Answer Question
Login to rate this answer.
c)faster than print. c)it returns a value either 0 or 1 depends on source.
Related Answered Questions Related Answered Questions
Java-class variable vs instance variable
Language and scripting language
What is the difference between view and materialised view?
Difference between test bed and test set
Black box testing
Difference between stop & abort
Sqldataadapter ,sqlcommand and SQLdatareader
What is the main difference between current and voltage?
Enter key carriage return or linefeed?
Mtl_system_items_b and mtl_system_items_kfv
Related Open Questions Related Open Questions
Oop concept
What is difference between s9(04) comp and 9(04) comp? (cobol comp with s and without s)
Common design pattern
Stress intensity and von misses stress
Function and method differences
Print the number in rverse order
Difference between include directive and script tag while including Java scripts file in JSP.
Wap on 3d matrix by using random function print o/p in a file.
Program on 3d matrix using random function print the o/p in file.
Testing
GeekInterview
About Us, Privacy Policy, Terms and Conditions, DMCA, Contact Us
Popular Sections
Code, Learn, Online Testing, Geek Talk,
Propose Category, Ask Question, Site Updates
Copyright 2012 GeekInterview.com | All Rights Reserved
What is the difference between echo and print? http://www.geekinterview.com/question_details/35222
8 of 8 13-09-2012 23:04

Potrebbero piacerti anche