[wp-hackers] echo and return

lowmagnet lowmagnet at lowmag.net
Tue Jul 27 16:52:49 UTC 2004


On Tue, Jul 27, 2004 at 10:45:35AM -0600, Randy Peterman wrote:
> I suppose that you could do
> <?php
> echo get_me_my_morning_paper();
> ?>
> <?=get_me_my_morning_paper();?>
> and
> <?php output_get_me_my_morning_paper();?>

I prefer the first, because the second is not always valid across all php installs, and the third is far too verbose. I would rather echo the_thing(); than anything, and I'll shut-up now about the subject until someone comes up with something contrary that changes my mind.

> There are times and places where both are useful, but I am more of the 
> opinion that in server side code adding to the number of functions the 
> PHP engine has to parse is not optimal.  Sure, speeds are generally good 
> for PHP (that's part of why we use it) but 'aerodynamics' should could 
> for something in coding style.  Looking at the syntax I'd prefer the 
> first two over the second.  I'm not keen un excess wrapper functions.  I 
> suppose the difference between a 'white rapper' and a 'write wrapper' is 
> minimal, they're just funky ;) **

we add little and take away little from the server by adding the functions, save parse time.

We can simplify things by using the echo function. We can simplify names by assuming 'the' functions return values, instead of printing (though this is not currently the standard). We can simplify parameters and use spaces in parameters by using array passing and array_merge.

Perhaps this needs to all be spelled out in the wiki, and we can tweak/edit thatinstead?

-eli



More information about the hackers mailing list