NYCPHP Meetup

NYPHP.org

[nycphp-talk] style question: returning from a function while you're in a foreach

David Mintz david at davidmintz.org
Wed Mar 20 10:15:41 EDT 2013


Just wanna say thanks for the comments.

I've since realized from looking at the Zend Framework, which aspires to
high standards, that they certainly do use the
return-as-soon-as-you-figure-it-out approach in method definitions that are
pretty short, and it's extremely clear reading.

If we look closer we'll probably find that they have the most likely ifs
before the less likely. So I'd say this approach is optimal from every
point of view.

On Sat, Mar 16, 2013 at 12:23 PM, Federico Ulfo <rainelemental at gmail.com>wrote:

> +1 for the first, because -3 lines of code -1 variable, but really either
> are good.
>
>
>


-- 
David Mintz
http://davidmintz.org/
Fight for social equality:
http://socialequality.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20130320/9e9910b3/attachment.html>


More information about the talk mailing list