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
Answered On : Oct 4th, 2006
Hi,
echo :-
- Is a command only.
- Faster than Print.
-
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.
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.
Answered On : Nov 2nd, 2006
echo is a statement and print is a function.
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.
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.
Answered On : Dec 13th, 2006
echo is a statement an does not return valueprint is a function and returns value
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.
Answered On : Dec 21st, 2006
echo : just output the content
print : it returns true for successful output and false for unsuccessful
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.
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
Answered On : Feb 5th, 2007
print is a function and returns true or false value where as echo is a command only...
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
echo() can take multiple expression bt print() cant
echo is not a function but print is a function echo is alias
echo can accept multiple argument
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");
print "and a 123";
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.
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
?>
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.
One is a function the other a statement. The function
these 2 have same meaning.
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.
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
Answered On : Jul 15th, 2011
both are used in php as output Streams.
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....
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
Answered On : Jul 27th, 2011
echo prints multiple values
print () only one value
Answered On : Jul 30th, 2011
Print will return TRUE/FALSE value while Echo doesn't return value and is little bit faster than Print.
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.
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.
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"))
Answered On : Sep 9th, 2011
echo can print multiple lines at time,but in case of print it will execute single line......
Answered On : Sep 12th, 2011
php syntax same as that of perl & C..so echo used for printing in php and print in C
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.
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.
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.
echo or print r d functions ....echo is mostly we r using in php
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
Answered On : Apr 19th, 2012
Echo and print both are same.. mostly the developer using echo because it is execution speed faster than print...
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..
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.
c)faster than print. c)it returns a value either 0 or 1 depends on source.
Answered On : Nov 29th, 2012
1. both are using to display the value.
2. echo is faster than print
3. echo displays multiple statements and variables but print only
4. print is function it returns a value.
Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.
