GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  PHP
Go To First  |  Previous Question  |  Next Question 
 PHP  |  Question 8 of 74    Print  
What is the difference between echo and print statement?

  
Total Answers and Comments: 7 Last Update: August 31, 2008     Asked by: Davinder Singh 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Trii
 
Actually . . .

echo and print are both language constructs and do not (and should not) require parenthesis. The difference is that print returns a value indicating success where echo does not

Above answer was rated as good by the following members:
brijbhushansh, prasad_konnur, leena.sajnani
May 29, 2006 08:29:58   #1  
Suparna Dey        

RE: What is the difference between echo and print stat...

Difference1:

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.


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
June 29, 2006 06:55:12   #2  
rabbi Member Since: June 2006   Contribution: 23    

RE: What is the difference between echo and print stat...
echo( something ) is always a function. print( something ) is a function butprint is not a function but simple a statement.
 
Is this answer useful? Yes | No
May 02, 2007 10:30:04   #3  
Trii        

RE: What is the difference between echo and print stat...
Actually . . .

echo and print are both language constructs and do not (and should not) require parenthesis. The difference is that print returns a value indicating success where echo does not

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 03, 2007 03:22:37   #4  
Shunmuga prasath        

RE: What is the difference between echo and print stat...
Print is a function whereas echo is a language construct.
You can use something link $a print $b while you cant use $a echo $b.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
November 17, 2007 00:49:20   #5  
Vignesh        

RE: What is the difference between echo and print stat...
Print is a Function. Echo is an keyword.

Print return true or false value on printing. Echo doesn't

Print cannot have multiple expression whereas Echo can have Multiple Expression statement to echo the value.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
January 17, 2008 05:22:54   #6  
subhadeep21 Member Since: January 2008   Contribution: 1    

RE: What is the difference between echo and print statement?
Both are language construct.
The only difference is:
print can evealuate expression and
echo can not.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 31, 2008 16:25:51   #7  
bluemonk Member Since: August 2008   Contribution: 1    

RE: What is the difference between echo and print statement?
Both echo and print are language constructs.

However print() acts like a function in that it returns a value and can be used in complex expressions.

Furthermore echo without parentheses can take multiple arguments. Echo with parentheses and print can only take a single argument.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape