Short Hand PHP, and Echo Statements

Quick ways to use the echo statement in php. Reduce the amount of your code with this quick tip.

Instead of writing out your echo statements you can use a quick short hand technique. To do this you must have “short_open_tag” allowed, this can be done in the php.ini file but is usually defaulted to true.

< ?='hello world'?> // will echo hello world

If doing this code doesnt produce the echo statement, there is a good chance that you do not have short_open_tag enabled.

Leave a Reply