[PHP] print() or echo
is it true that echo is a bit faster than print()? in general, when we don't need a return value, which one is better to choose? Cheers, Danial Rahmanzadeh
Re: [PHP] print() or echo
On Tue, 2007-02-13 at 19:19 +0330, Danial Rahmanzadeh wrote: is it true that echo is a bit faster than print()? in general, when we don't need a return value, which one is better to choose? Yes, echo is faster than print. I would suggest echo over print since it is shorter and faster :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print() or echo
As referenced in the manual ( http://us2.php.net/manual/en/function.echo.php ), check out this url: http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40 Short story, there is a difference, but the speed difference is negligable. If anyone cares, I prefer echo too. Not sure why. Shorter to type, old habits (coming more from a scripting background than a real programming background even though I've done some of that too), who knows? Part of it may be the desire to have my code do what it needs to do and nothing more. Print returns a value, which I don't use, so why would I want it to do that? That's a little anal retentive, but every little bit helps I suppose, even if it's a negligable difference. -TG = = = Original message = = = On Tue, 2007-02-13 at 19:19 +0330, Danial Rahmanzadeh wrote: is it true that echo is a bit faster than print()? in general, when we don't need a return value, which one is better to choose? Yes, echo is faster than print. I would suggest echo over print since it is shorter and faster :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print() or echo
negligible.. blarg spelling. :) = = = Original message = = = As referenced in the manual ( http://us2.php.net/manual/en/function.echo.php ), check out this url: http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40 Short story, there is a difference, but the speed difference is negligable. If anyone cares, I prefer echo too. Not sure why. Shorter to type, old habits (coming more from a scripting background than a real programming background even though I've done some of that too), who knows? Part of it may be the desire to have my code do what it needs to do and nothing more. Print returns a value, which I don't use, so why would I want it to do that? That's a little anal retentive, but every little bit helps I suppose, even if it's a negligable difference. -TG = = = Original message = = = On Tue, 2007-02-13 at 19:19 +0330, Danial Rahmanzadeh wrote: is it true that echo is a bit faster than print()? in general, when we don't need a return value, which one is better to choose? Yes, echo is faster than print. I would suggest echo over print since it is shorter and faster :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print() or echo
echo is slightly faster than print and it takes multiple arguments so instead of: echo 'p' . $test . '/p'; you can do echo 'p' , $test , '/p'; which should be faster, and I say 'should' just because as print should be slower because it has to go into the trouble of setting up a return value, so avoiding doing a concatenation first and then output the whole thing by just streaming each of the pieces to the output straight away should be faster, though string operations are so optimized as to be neglig well, you can't tell the difference. Satyam - Original Message - From: Danial Rahmanzadeh [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, February 13, 2007 4:49 PM Subject: [PHP] print() or echo is it true that echo is a bit faster than print()? in general, when we don't need a return value, which one is better to choose? Cheers, Danial Rahmanzadeh No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 12/02/2007 13:23 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On Tue, 26 Sep 2006 21:45:58 +1000, David Tulloh wrote: Google Kreme wrote: On 25 Sep 2006, at 06:11 , Sancar Saran wrote: ... If this is generating hundred of K of HTML, use ' instead of (yes, it's faster). I've seen this stated several times and at first glance it seems to make sense. The double quoted version has all the \n and related characters that need to be handled. Except that php is a C program and uses the printf family of functions. This means that all the single quoted strings actually have to be converted to escaped versions of double quoted strings, so internally '\n' becomes \\n. You can see this in some benchmarks, I ran the following script and a single quoted version from the command line. I ran each 10 times, interleaved to try to balance changes in the system load. ?php $str=; for($i=0; $i1000; $i++) $str.=foo; ? I found that the double quoted version averaged 5.5516 seconds against the single quoted script of 5.5627. Which really goes to show that while the double quoted version is faster the difference is almost completely irrelevent. While we're at it (running benchmarks three times, varying amount of loops): Benchmarking with 100K loops Case 1 : 'Adding a 10-character single quoted string to a var' Time : 0.23s - 0.24s Case 2 : 'Adding a 10-character double quoted string to a var' Time : 0.23s - 0.24s Performance : Anywhere between Decreased 1.1% and Increased 26.7% This seems really funny to me, cause I was under the impression a single quoted string was faster... I remember benchmarking that before. Benchmarking with 10K loops Case 1 : 'Adding a 100-character single quoted string to a var' Time : 0.03s - 0.08s Case 2 : 'Adding a 100-character double quoted string to a var' Time : 0.03s Performance : Anywhere between Increased 0.7% and Increased 66.9% Still funny... and numbers get higher, too. Benchmarking with 1M loops Case 1 : 'Setting a var with a 100-character single quoted string' Time : 2.29s - 2.63s Case 2 : 'Setting a var with a 100-character double quoted string' Time : 2.53 - 2.78s Performance : Anywhere between Decreased 3.1% and Decreased 16.3% Now this is probably what I saw previously and what made me decide using single quotes where possible. Benchmarking with 1M loops Case 1 : 'Setting a var with a 100-character single quoted string incl. a variable (concat)' Time : 3.59s - 4.07s Case 2 : 'Setting a var with a 100-character double quoted string incl. a variable' Time : 4.14s - 4.40s Performance : Anywhere between Decreased 8.2% - Decreased 19.2% Well, try not to use variables in a string, but concatenate it together. Benchmarking with 1M loops Case 1 : 'Setting a var with a 100-character double quoted string incl. a variable (concat)' Time : 3.58s - 3.79s Case 2 : 'Setting a var with a 100-character double quoted string incl. a variable' Time : 4.12s - 5.24s Performance : Anywhere between Decreased 14.9% - Decreased 38.4% Same with using double quoted strings only... Hey! It's coffee break already! Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On Wed, September 27, 2006 3:37 am, Sancar Saran wrote: Thanks for supporting, because of approaching the problem I don't want to change generate once echo one style. And I found solution like this, I split variable into an array and generate loop for printing, mostly fix the problem. And more interesting, some times problem repeates himself. I believe this was connected to php memory performance. Anyhow is there any information about optimal echo or print size ? You could try to generate some stats to add to the pool of knowledge. I suspect it's so tied to hardware, load, OS, bandwidth-pipesize that all that has to be reported to be useful. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
Google Kreme wrote: On 25 Sep 2006, at 06:11 , Sancar Saran wrote: ... If this is generating hundred of K of HTML, use ' instead of (yes, it's faster). I've seen this stated several times and at first glance it seems to make sense. The double quoted version has all the \n and related characters that need to be handled. Except that php is a C program and uses the printf family of functions. This means that all the single quoted strings actually have to be converted to escaped versions of double quoted strings, so internally '\n' becomes \\n. You can see this in some benchmarks, I ran the following script and a single quoted version from the command line. I ran each 10 times, interleaved to try to balance changes in the system load. ?php $str=; for($i=0; $i1000; $i++) $str.=foo; ? I found that the double quoted version averaged 5.5516 seconds against the single quoted script of 5.5627. Which really goes to show that while the double quoted version is faster the difference is almost completely irrelevent. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On Tuesday 26 September 2006 02:07, Robert Cummings wrote: On Mon, 2006-09-25 at 17:39 -0600, Google Kreme wrote: I'm sitting here with 4 Gigs of RAM trying to figure out how to use it all... :-) (Me, in 2005) Not really related to the post... but I find a good way to eat up 4 gigs of RAM is to run several VMWare nodes :) Depending on what these nodes do, it can also be a great way to eat up those dual core processors :) Forget 'bout em vmware stuff. Imagine putting those ramdisks to good use. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | | :: : | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On Mon, September 25, 2006 7:11 am, Sancar Saran wrote: When I was check the performance of my system I found interesting resuts. My code stores html output into a variable. When page creation complete I printed out the variable. Problem was generation html code takes 0.5 second and just echo $strPage takes 2.0 or more second. my code structure was. $strPage = html yada dayda; ... $strPage.= another html tags; ... $strPage.= getSqlDataAndCreateSomeHtmlCOde(); ... end of page creation. Current Total execution time 0.5 seconds. print $strPage; Current Total execution time 2.5 seconds. $strPage carries entire html structure (for example equal of 100K html code); excluding the cookie and other kind of header transfers and error messages, there was no print or echo command was submitted. Is there any idea about this latency and any idea to find problem... You could try echo-ing it out in chunks instead of waiting until the very end. echo/print has to send the data out through the very narrow pipe to Apache - the browser If you send every little snippet one tiny piece at a time, you waste resources. If you wait until the end and send out some huge monster string, you waste resources. Find the balance if you can. Depends on your hardware/bandwidth exactly where optimum is. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On Tue, September 26, 2006 12:16 pm, Børge Holen wrote: On Tuesday 26 September 2006 02:07, Robert Cummings wrote: On Mon, 2006-09-25 at 17:39 -0600, Google Kreme wrote: I'm sitting here with 4 Gigs of RAM trying to figure out how to use it all... :-) (Me, in 2005) Not really related to the post... but I find a good way to eat up 4 gigs of RAM is to run several VMWare nodes :) Depending on what these nodes do, it can also be a great way to eat up those dual core processors :) Forget 'bout em vmware stuff. Imagine putting those ramdisks to good use. I wonder what would happen if you put your swap on a RAM disk? Wouldn't that be really fast?! -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On 9/26/06, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, September 26, 2006 12:16 pm, Børge Holen wrote: On Tuesday 26 September 2006 02:07, Robert Cummings wrote: On Mon, 2006-09-25 at 17:39 -0600, Google Kreme wrote: I'm sitting here with 4 Gigs of RAM trying to figure out how to use it all... :-) (Me, in 2005) Not really related to the post... but I find a good way to eat up 4 gigs of RAM is to run several VMWare nodes :) Depending on what these nodes do, it can also be a great way to eat up those dual core processors :) Forget 'bout em vmware stuff. Imagine putting those ramdisks to good use. I wonder what would happen if you put your swap on a RAM disk? I actually have done this, it works like a charm :) you just have to ensure swap doesn't run out... of course i'd only recomend this on a dedicated machine for like firewalling or a gateway. Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On Tue, September 26, 2006 6:35 pm, Curt Zirzow wrote: I wonder what would happen if you put your swap on a RAM disk? I actually have done this, it works like a charm :) you just have to ensure swap doesn't run out... of course i'd only recomend this on a dedicated machine for like firewalling or a gateway. Like... Wouldn't it just make more sense to not have swap at all?... I mean, you can only be increasing overhead and whatnot... I suppose if you just plain CANNOT build the system with no swap, because the tools won't let you do that... H. Never tried to build a swap-less box, for obvious reasons... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On Tue, 2006-09-26 at 18:46 -0500, Richard Lynch wrote: On Tue, September 26, 2006 6:35 pm, Curt Zirzow wrote: I wonder what would happen if you put your swap on a RAM disk? I actually have done this, it works like a charm :) you just have to ensure swap doesn't run out... of course i'd only recomend this on a dedicated machine for like firewalling or a gateway. Like... Wouldn't it just make more sense to not have swap at all?... I mean, you can only be increasing overhead and whatnot... I suppose if you just plain CANNOT build the system with no swap, because the tools won't let you do that... H. Never tried to build a swap-less box, for obvious reasons... *lol* I was gonna say, why the hell would anyone make swap into a ramdisk when the memory used for the ramdisk would be better used as primary RAM. I presumed you were joking Richard which you clarify above, but Curtis now has me wondering :B The only time I'd use a ramdisk for swap is if I had the extra cash to shell out for one of the pretend hard drives that really map to RAM... like this sucker: http://www.shoprbc.com/ca/shop/product_details.php?pid=13968 Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: Re: [PHP] Print or Echo takes lots of time
-- Forwarded Message -- Subject: Re: [PHP] Print or Echo takes lots of time Date: Wednesday 27 September 2006 06:37 From: Børge Holen [EMAIL PROTECTED] To: [EMAIL PROTECTED] On Wednesday 27 September 2006 01:46, Richard Lynch wrote: On Tue, September 26, 2006 6:35 pm, Curt Zirzow wrote: I wonder what would happen if you put your swap on a RAM disk? I actually have done this, it works like a charm :) you just have to ensure swap doesn't run out... of course i'd only recomend this on a dedicated machine for like firewalling or a gateway. Like... Wouldn't it just make more sense to not have swap at all?... I mean, you can only be increasing overhead and whatnot... I suppose if you just plain CANNOT build the system with no swap, because the tools won't let you do that... H. Never tried to build a swap-less box, for obvious reasons... I've done that since '01. Never any occurences (witch WILL happen whenever you run out). Of course never on a production machine, but my desktop and laptop sure got none. -- Like Music? http://l-i-e.com/artists.htm -- --- Børge Kennel Arivene http://www.arivene.net --- --- -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Print or Echo takes lots of time
Hi, When I was check the performance of my system I found interesting resuts. My code stores html output into a variable. When page creation complete I printed out the variable. Problem was generation html code takes 0.5 second and just echo $strPage takes 2.0 or more second. my code structure was. $strPage = html yada dayda; ... $strPage.= another html tags; ... $strPage.= getSqlDataAndCreateSomeHtmlCOde(); ... end of page creation. Current Total execution time 0.5 seconds. print $strPage; Current Total execution time 2.5 seconds. $strPage carries entire html structure (for example equal of 100K html code); excluding the cookie and other kind of header transfers and error messages, there was no print or echo command was submitted. Is there any idea about this latency and any idea to find problem... Regards Sancar Saran -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On 25 Sep 2006, at 06:11 , Sancar Saran wrote: $strPage = html yada dayda; ... $strPage.= another html tags; ... $strPage.= getSqlDataAndCreateSomeHtmlCOde(); If this is generating hundred of K of HTML, use ' instead of (yes, it's faster). -- I'm sitting here with 4 Megs of RAM trying to figure out how to use it all... :-) (Me, in 1990) I'm sitting here with 4 Gigs of RAM trying to figure out how to use it all... :-) (Me, in 2005) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print or Echo takes lots of time
On Mon, 2006-09-25 at 17:39 -0600, Google Kreme wrote: I'm sitting here with 4 Gigs of RAM trying to figure out how to use it all... :-) (Me, in 2005) Not really related to the post... but I find a good way to eat up 4 gigs of RAM is to run several VMWare nodes :) Depending on what these nodes do, it can also be a great way to eat up those dual core processors :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] print and echo
What's the difference between these two and is there a preference in which one to use? -Wade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] print and echo
This has been answered several times I think check here http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40 CAA -Original Message- From: Wade [mailto:[EMAIL PROTECTED]] Sent: Monday, April 23, 2001 10:43 AM To: [EMAIL PROTECTED] Subject: [PHP] print and echo What's the difference between these two and is there a preference in which one to use? -Wade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] print and echo
Thank you! Angerer, Chad [EMAIL PROTECTED] wrote in message 9E35C54B0C7AD411B5C1009027DE539940B5ED@MSPMX01">news:9E35C54B0C7AD411B5C1009027DE539940B5ED@MSPMX01... This has been answered several times I think check here http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40 CAA -Original Message- From: Wade [mailto:[EMAIL PROTECTED]] Sent: Monday, April 23, 2001 10:43 AM To: [EMAIL PROTECTED] Subject: [PHP] print and echo What's the difference between these two and is there a preference in which one to use? -Wade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Print or Echo.
H- Just a quick question. Is there any difference between using print or echo? From what I have read and seen there isn't any. Than why the two different commands? Thanks. -Sterling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print or Echo.
Than why the two different commands? Simple - some people come from C which uses print ... others come from languages that use echo. It fosters adaptation by other programmers. --Joe Thanks. -Sterling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /**\ *Joe Stump - PHP/SQL/HTML Developer * * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net * * "Better to double your money on mediocrity than lose it all on a dream." * \**/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Print or Echo.
H- Just a quick question. Is there any difference between using print or echo? From what I have read and seen there isn't any. Than why the two different commands? Thanks. -Sterling See this: http://www.php.net/manual/en/function.print.php "As for a print vs. echo, echo gives you more options, such as being able to continue output on multiple lines like an EOT in perl. Look at the above notes. With print you would not be able to accomplish this." Jeff Oien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print or Echo.
Jeff Oien wrote: "As for a print vs. echo, echo gives you more options, such as being able to continue output on multiple lines like an EOT in perl. Look at the above notes. With print you would not be able to accomplish this." There's another difference. print() returns true on success and false when called after a connection abort. Echo doesn't, and that's why it's slightly (very slightly) faster. regards Wagner -- Assumption is the mother of all fuck-ups. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print or Echo.
See this faq : What is the difference between echo and print? --- http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40 regards, philip On Fri, 6 Apr 2001, Sterling wrote: H- Just a quick question. Is there any difference between using print or echo? From what I have read and seen there isn't any. Than why the two different commands? Thanks. -Sterling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Print or Echo.
-Original Message- From: Alexander Wagner [mailto:[EMAIL PROTECTED]] Sent: Friday, April 06, 2001 3:24 PM To: [EMAIL PROTECTED] Cc: PHP Subject: Re: [PHP] Print or Echo. Jeff Oien wrote: "As for a print vs. echo, echo gives you more options, such as being able to continue output on multiple lines like an EOT in perl. Look at the above notes. With print you would not be able to accomplish this." There's another difference. print() returns true on success and false when called after a connection abort. Echo doesn't, and that's why it's slightly (very slightly) faster. regards Wagner http://www.e-gineer.com/articles/php-hackers-paradise.phtml More details here on Print/Echo/Inline Jason Lotito www.NewbieNetwork.net Where those who can, teach; and those who can, learn. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Print vs. Echo
What is the basic difference between print and echo? As I am understanding it, Echo allows you to define a multi-line area to output text without having to repeat quoting for each line but then what is the advantage of print? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print vs. Echo
Have a look here : What is the difference between echo and print?: --- http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/41 Philip On Thu, 18 Jan 2001, Karl J. Stubsjoen wrote: What is the basic difference between print and echo? As I am understanding it, Echo allows you to define a multi-line area to output text without having to repeat quoting for each line but then what is the advantage of print? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]