Skip to content
Advertisement

Should I use echo or print in php scripts?

Which statement should I use in php scripts? Echo or Print? What is faster and mostly used? Thanks in advance.

Advertisement

Answer

Supposedly echo is faster, but either one would work just fine.

Echo also offers a shortcut syntax when embedding php in HTML. i.e.

    I have <?=$foo?> foo.

vs

     I have <?php echo $foo;?> foo.

See http://us2.php.net/manual/en/function.echo.php

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement