PHP Performance Question effect of ;

Posted on 2008-11-04
Last Modified: 2013-12-13
Which one is good for performance
<?php echo "Something";?> or <?php echo "Something"?>

what is the effect of ; to performance
Question by:phparmy
    LVL 17

    Assisted Solution

    AFAIK, the ";" has absolutely no implication on performance at all. It is used only for syntax.

    In your example above, you don't need the ; at all, since there is nothing following, but for multiple calculations, assignments etc, you need to use ;
    LVL 6

    Accepted Solution

    Also, to add to what psimation stated. For a simple php echo statement in html you can also use the shorthand version <?="something"?> or <?=$myVariable?> it won't hurt your performance, and it sure saves you a few keystrokes.
    LVL 3

    Assisted Solution

    It won't have any performance impact. Take into account that the PHP file is parsed before execution, so it won't make any difference but in the first parsing, perhaps. You won't notice any measurable impact anyway. As lpxtech said, <?=$var?> is very handy for fast coding and for getting a more readable code.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now