![]() |
| Sponsored Links (We share ad revenue): |
|
|
|
|
Ultra Talker
Posts: 271
Location: CA
|
From what I understand, echo() is slightly faster than print(). However, the difference is probably insignificant.
One thing though, if you want to echo() a large block of code, like a table or something, I've heard that instead of doing this: PHP Code:
PHP Code:
__________________
Free Teacher Websites Last edited by Phaedrus : 03-27-2005 at 04:21 PM. |
|
|
|
|
|
|
|
Experienced Talker
Posts: 36
|
All of your questions can be answered correctly at their corrosponding pages in the PHP manual (www.php.net/function_name).
|
|
|
|
|
|
|
|
Iced Cap
Latest Blog Post:
php|architect’s Guide to Programming wi... Posts: 3,105
Location: Toronto, Ontario
|
echo will be a little bit faster because it will not return a value. The difference in speed, however, would be insignificant as Phaedrus stated.
print is good when you need to use it as a function, for example: PHP Code:
![]()
__________________
Devlog - Latest PHP Article: MVC with the Zend Framework ::The New Tech - Technology Forum |
|
|
|
|
|
Re: Print VS Echo |
|
Junior Talker
Posts: 1
Name: Gordon Jewett
|
This seems to answer this topic pretty well...
http://www.faqts.com/knowledge_base/...l/aid/1/fid/40 |
|
|
|
|
|
Re: Print VS Echo |
|
Eat, Sleep, Code
Latest Blog Post:
XDnet.co.uk The new name of Dansgalaxy Hosting. Posts: 5,381
Name: Dan
Location: Swindon
|
Just to say about require and include.
require() (or require_once()) means that if it cannot include it for what ever reason the whole script will stop and return error. Include (or include_once()) means it will try and continue running even if PHP cannot load the file. As far as i know neither nor is specifically used in loops or switches although often they are. Usually i would say require would be good for things like config files which have to be loaded where as if the file to be used is something like a template file maybe include would be better. Also incase you were wondering require/include_once() means IF it hasnt already been loaded before load it if it has dont, usually helpful for things like functions files so it doesnt cause reclassification errors where it tries to make a function twice. Hope this helps ![]() TP appriciarted if it did ![]()
__________________
Support Children's Cancer and Leukaemia Movement shop online at buy.at/calm ~ Calmcharity.org PHP Code:
|
|
|
|
|
|
Re: Print VS Echo | |
|
Skilled Talker
Posts: 97
Name: Chris Duerr
|
Quote:
For what it's worth, I see way too many PHP apps using include(), and providing no error notification, when they should be using require(). Similarly, the value of the require_once() and include_once() functions shouldn't be under-estimated.
__________________
Chris Duerr AddonChat Java Chat Software http://www.addonchat.com/ - Affiliate Program |
|
|
|
|
| Sponsored Links (We share ad revenue): |
| Thread Tools | |
|
|
| Webmaster Resources Marketplace: |
| Software Development Company | Webhosting.UK.com |
| Web Templates | Text Link Brokers | Stock Photos |