FollowText.com
 
 Welcome Guest Home | Submit Article | Contact | Search

FollowText.com » Internet » Web-development » Php » Differences Between Two Printing Commands In PHP


Differences Between Two Printing Commands In PHP

by: ZacharySchuessler
Total views: 9 | Word Count: 441


PHP is a highly robust language- one that has attracted web developers from all across the world to take place in the web application craze that's been raging. Getting the most out of the language means understanding it- and something most developers don't know is simple things such as the difference between Echo and Print.

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?

The two language constructs Print and Echo differ because Echo does not return a value- although Print does. This is an odd thing to have, however, since a command used to output data to the screen will almost never need to return a value. In fact, even those who have been in the programming industry for years have probably never seen a good use of Print where Echo couldn't follow.

There is the issue of speed that comes along with the fact that Print has to return a value. The extra load will indeed affect performance, but on such a small level that it isn't even noticeable. It is recommended that PHP developers not take such a trivial amount of performance into mind, and instead pick the printing command that best suits them.

When a PHP developer looks around at examples and scripts from others in the community, they will see that Echo is used much more often. This isn't because of speed, as previously discussed, but because many think it easier to type and the keyword command is more appealing in design. The success of Echo has been compounded after many publishers make books and online resources that sport the term.

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.



About the Author

Learn more on Click Here and Echo Script.  



More Articles from: PHP

1: Points In PHP And SQL Security Topics Explained
    (By: ChrisChanning, On: Jul 16th 2008, Words: 497, Views: 9)
2: Differences Between Two Printing Commands In PHP
    (By: ZacharySchuessler, On: Jul 16th 2008, Words: 441, Views: 9)
3: How PHP Developers Differentiate Between Print And Echo
    (By: ZacharySchuessler, On: Jul 13th 2008, Words: 446, Views: 9)

FollowText.com » Internet » Web-development » Php » Differences Between Two Printing Commands In PHP



Main Menu
Home
Login
Register Now!
Submit Article
Latest Articles
Search
Categories
Accounting
Beauty
Business
Career
Cars and Trucks
Computers
Culture and Society
Environment
Family
Finance
Fitness
Food and Drink
Free Tools & Resources
Health
Hobbies
Home
Humor
Inspirational / Motivational
Internet
    ASP
    CGI
    Cold Fusion
    CSS
    DHTML
    HTML
    Java
    Perl
    PHP
    Scripts
    SGML
    SMIL
    SSL
    XHTML
    XML
Internet Marketing
Legal Informations
Marketing
Men's Issues
Music
Personal Development
Pets and Animals
Politics
Psychology
Publishing
Recreation and Leisure
Relationships
Religion and Spirituality
Science
Speaking
Technology
Women's Issues
Writing

Algarve - A complete guide to all resorts in the Algarve.

Algarve Airport Transfers - An Airport Transfers company completely owned by ExPats.

Calling Cards - Lowest rates international calling card plans.

7 users online. 0.45s