Home | Root Category
Few other web development languages have done as much for web developers as PHP has. And in learning all the complexities of the language, web developers will be able to better become higher paid, more satisfied, and better prepared to make the next best web application. But taking baby steps in getting there is important: and the finer things such as knowing the difference between Echo and Print become clear. Echo and Print are both commands used to display something to the browser. Both are used in similar structure, and both are identical in output. So what, then, is the use for having two commands that appear to do the exact same thing? As it turns out, Echo is actually a language construct that doesn't return a value, in which Print does. This simple fact means that Print can be used in some instances where Echo can't, although developers will probably never run into such a situation. In fact, many PHP developers stick with Echo their entire career and will never see a problem. Speed is a major concern in web applications. This holds true with the Print and Echo commands since it is logical to think that Print would cost more in resources to operate. This logic is actually true, although the differences in performance are so small that it isn't even worth choosing one construct over the other solely based on performance. So far the industry standard has been to use Echo, but it should be stressed that either command may be used at will. Echo seems to be the favorite as it is easier to type, not to mention it's a fun word to say! Those who favor the Print command are usually older programmers, who are accustomed to using the command Print from other programming languages that are now considered archaic. As a last note of worthiness, it should be made clear that if speed is an issue, more emphasis should be put on how the two commands are used. Repeatedly using either command where a programmer could simply concatenate a string or value together will waste system performance- and on a much more noticeable scale that the difference between returning a value or not. Thus, this subject should be addressed if anything in regards to speed. Final Thoughts PHP development just wouldn't be the same without fun debates such as the one just mentioned. But in reality, it really doesn't matter which route is taken- so long as either language construct is used in a performance-based manner. Although Print may still have somewhat of a following today, as books and publishers start using Echo more often, it's likely we'll see a death to the Print command soon enough.
Article Source: http://www.a1-articledirectory.com
Learn more on PHP Print and PHP Echo.
Please Rate this Article
5 out of 54 out of 53 out of 52 out of 51 out of 5
Not yet Rated