![]() |
What the different between print and echo Hi old warrior member, What is difference between print and echo |
Re: What the different between print and echo Who are you calling "old"???? I assume you are speaking about PHP here, as many other languages use similar statements. Technically echo is a bit faster than print, although we are probably talking nanoseconds here. Print also has a return value (i.e true or false), where as echo doesn't. However echo can accept multiple statements but print can't (i.e echo "The first", "the second";). For all practical purposes use the one that makes you happy! I guess echo has one less character to type! Bill |
Re: What the different between print and echo Not much difference between print and echo. The main differnce is that echo can take multiple expressions and its a bit faster than print |
Re: What the different between print and echo print does the same thing as echo except echo is a language construct and not a real function so it's syntax is different. echo is a statement while print is a function we can't print whole array by using echo or print. For this we have to use the print_r function |
Re: What the different between print and echo A lot of people seem to prefer echo because it runs a little faster (very likely an insignificant amount of time will be gained). There are a few situations in more complicated code where print is preferred because it can return a true/false where echo does not. Very few people care about these technical differences and use them interchangeably. |
Re: What the different between print and echo Personally, I use echo for generic printing to the document..specially when there is a lot of printing to be done. I only use the print function when there is further formatting or processing needed...like making sure something was printed using the bool return from the print function or formatting strings (like currency formats). Echo is faster than print and there is a noticeable speed difference when printing large strings. To sum it up: Use echo when printing anything. Only use print when you need to print something in a special way or for bool testing. <My two pennies> |
Re: What the different between print and echo echo can take multiple expressions + bit faster than print |
Re: What the different between print and echo The different between print and echo : - Echo works faster than print() - Echo and print are language construct - Echo is not suitable for conditional construct - Print is suitable for conditional construct - Print process is slower than echo - Print returns an integer values - Echo does not returns any values |
Re: What the different between print and echo Yes not much difference between print and echo. Only syntactically echo is different with print |
Re: What the different between print and echo Print : Prints the Line with formatted output Echo : Just print and goes to next line |
Re: What the different between print and echo The difference between print() & echo()? 1. Echo() can take multiple expression eg: Echo 'sundar','MCA'; // sundarMCA 2. Print() cannot take multiple expression eg print 'sundar','MCA'; // Parse Error 3. Echo() doesn`t return any values. 4.print() return values. ;) |
Re: What the different between print and echo Basic difference is that echo is not a function like print(). As such echo runs faster than print(). |
Re: What the different between print and echo Prints the Line with formatted output. Echo is just print and goes to next line. Echo is not best for conditionally construct. Print is best for conditionally construct. |
Re: What the different between print and echo The funny thing to me is that even though I know they are pretty close to the same, I find myself constantly changing prints to echos when I take over code from someone else. I realize that it is a waste of time, but still can not find the willpower to stop myself. Argh. |
Re: What the different between print and echo Some people seem to prefer echo because it runs a little faster.There are a few situations in more complicated code where print is preferred because it can return a true/false where echo does not. |
Re: What the different between print and echo Print: a process for reproducing text and image, typically with ink on paper using a printing press. It is often carried out as a large-scale industrial process, and is an essential part of publishing and transaction printing Echo: Repetition of a sound by reflection of sound waves from a surface :) |
Re: What the different between print and echo Quote:
|
Re: What the different between print and echo 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. |
Re: What the different between print and echo Lagest difference is: Print is suitable for conditional construct - but echo - not |
Re: What the different between print and echo Quote:
|
Re: What the different between print and echo echo has the slight performance advantage because it doesn't have a return value. They both have the same functions but have different procedures that result to the same output. |
Re: What the different between print and echo As for echo statement.it doesn't return value of , the print which always return one and 0. |
Re: What the different between print and echo For example, you can use this with print. PHP Code: PHP Code: |
Re: What the different between print and echo Echo can take multiple parameters to echo.This is not true with print. The "echo" and "print" tests can be tailored depending on what you are actually using it for. In general echo is faster, although there's cases where print can be faster. |
Re: What the different between print and echo echo vs. print Benchmarks : Code: echo ''Code: print ''Code: echo 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa'Code: print 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa'Code: echo 'aaaaaaa'.'aaaaaaa'.'aaaaaaa'.'aaaaaaa'Code: echo 'aaaaaaa','aaaaaaa','aaaaaaa','aaaaaaa'Code: print 'aaaaaaa'.'aaaaaaa'.'aaaaaaa'.'aaaaaaa'Code: $ var = 'aaaaaaa';Code: $ var = 'aaaaaaa';Code: $ var = 'aaaaaaa';Code: $ var = 'aaaaaaa';Code: $ var = 'aaaaaaa';Code: $ var = 'aaaaaaa';remove space between dollar and var. |
Re: What the different between print and echo Echo is a statement print is a function.echo print the multiple function but print function print statement.The only difference between print & echo is that both of them displays leads to different format. |
Re: What the different between print and echo Both do the same job, but there is a slight difference between print and echo so it usually comes down to a matter of personal preference. |
Re: What the different between print and echo Given the programming language wasn't specified, I'll assume bash as the language. In which case, echo is a builtin bash function, whereas print is an external command and therefore requires the overhead (albeit small) to fork a new process. |
| All times are GMT -6. The time now is 03:02 AM. |