|
Posted by Andy Hassall on 06/02/05 01:24
On Wed, 1 Jun 2005 15:11:34 -0700, "Tony" <someone@somewhere.not> wrote:
>I'm just wondering why it seems most people use "echo" instead of "print". I
>tend to use "print", probably because I started programming in BASIC back in
>78, so it's just familiar.
>
>Echo can take multiple expressions (as in "echo
>$string1,$string2,$string3"), which apparently is a bit faster than multiple
>concatenations. But for basic output, there doesn't seem to be a noticeable
>difference. The speed test at http://dynacker.dotgeek.org/printvsecho/ shows
>a "5%" difference in speed, but this amounts to a negligible difference in
>actual execution time on a typical script.
>
>So - why does one choose "echo" over "print", or vice-versa?
I use print, with the only reason being that I am quite fond of printf - so if
I change a line from print to printf I only need to add a character.
Possibly with a further reason that I use Perl a bit as well, which uses
'print'.
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Navigation:
[Reply to this message]
|