This is a discussion on "Echo vs Print" within the PHP Forum section. This forum, and the thread "Echo vs Print are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Echo vs Print
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Echo vs Print
Hello All -
I've been nosing around forums and looking at code posted - I keep seeing echo being used and it is not mentioned in the PHP5 book I am reading. I looked for echo in the back of the book and it is not mentioned at all. Is there a preference or was echo replaced with print for PHP5 as I know nothing about PHP 3 or 4? I was playing around with a very simple script that uses three lines of echo to print out strings where one line of print with the strings concantenated worked also. Just curious as to why my book doesn't mention echo. Thanks Sqrlgrl |
|
|
|
#2
|
|||
|
|||
|
There has been a lot of debate about print and echo in the PHP community over the years. There is actually almost no difference between them. In fact some people use echo just because it looks cooler.
Basic tests show that echo is faster, the reason being that echo returns nothing, print returns true, but these tests are not definitive. The only actual difference between them in terms of use is that print can be used as a function:
|
|
#3
|
|||
|
|||
|
Thanks
For now I will stick with print since that is what the book is teaching. I've been looking around the whole forum and reading some of the Flash Actionscript posts. You're a very busy man Karl! Looks like everyone keeps you on your toes with their questions and your answers are always explaining why and not just an answer - very helpful. Very glad I found this site!! Sqrlgrl |
|
#4
|
|||
|
|||
|
It certainly keeps me busy - and I enjoy it! I also learn a great deal this way - having to explain things keeps them fresh in my mind and I often have to learn new things to answer questions. Thanks for your kind comments!
|
![]() |
| Tags |
| echo, print |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| echo proxy to csv | stiassny | JavaScript Forum | 1 | Apr 13th, 2008 16:51 |
| How do I echo <?php ..... | AdRock | PHP Forum | 12 | Sep 14th, 2007 13:20 |
| Echo and If | simonb | PHP Forum | 2 | Aug 27th, 2007 16:22 |
| how to echo 2 classes | geyids | PHP Forum | 3 | Aug 9th, 2007 13:47 |
| Echo and Sessions | kool77 | PHP Forum | 6 | Jun 1st, 2007 22:32 |