NYCPHP Meetup

NYPHP.org

[nycphp-talk] Accessing non-existent array elements ok?

David Mintz david at davidmintz.org
Tue Aug 19 09:18:03 EDT 2008


On Mon, Aug 18, 2008 at 11:27 PM, Daniel Convissor <
danielc at analysisandsolutions.com> wrote:

>
> > >
> > >Does using an array reference &$array buy you anything in this instance?
> >
> > The basic idea is you don't know how big the array is and you don't want
> > to pass anything more than you want to.
>
> PHP functions always act on a pointer/reference of the input value UNTIL
> you write to it.  So, in this case, making $array a reference buys you
> nothing.  I don't know if it penalizes you, though.
>
>

I heard somewhere that it does cost to reference/de-reference for no good
reason, and that if youi're not going to write to it, pass it by value not
reference. But I don't remember when or where, so don't ask me support that
with things like facts or sources.

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080819/f536746c/attachment.html>


More information about the talk mailing list