Actually Todd, ...
> There is no way to call a function
> before doing the work in the argument list. If I call f(1+2),
> I can be sure the computation to get 3 will be performed
> _before_ calling f. The issue with f($p=array()) is that
> "$p=array()" is an r-value.
...that is theoretically very possible, and it's something called "lazy
evaluation": http://en.wikipedia.org/wiki/Lazy_evaluation
- Ron
"Todd Ruth" <truth@proposaltech.com> wrote in message
news:1153763607.30382.184.camel@notebook.local...
> It looks like
> http://www.php.net/manual/en/language.operators.assignment.php
> could use a bit of updating. A paragraph about php 5 or a
> link to the semantics changes for php 5 would help newbies.
> The text about php4 says there is copy on assignment, which
> implies a performance hit for using = instead of =&, but I
> believe "copy on change" is more accurate. It wouldn't hurt
> to explicitly say that "=" is generally better than "=&"
> (unless you really need an alias). A user comment has been
> there unchallenged for over 2 years saying you can pass an
> assignment as a reference to a function, so it isn't surprising
> that someone considered the 5.1.1 to 5.1.2 change an issue.
> (Not that a user comment should bind the php devs, but when
> the comment goes unchallenged, it can lead to false impressions.)
> Perhaps some text explaining the assignment returns an r-value
> would be helpful. (If people understand "($x = 1) = 2;"
> shouldn't work, they might understand that passing "$x=1" to
> a function by reference shouldn't affect $x. (or should
> "($x = 1) = 2;" work and 5.1.2 had a real bug?))
>
> I have to say the documentation for php is completely awesome
> and is a major factor in our company using the language. I
> just point out the above to help; it isn't a complaint.
>
> BTW, I disagree with the post below that indicates the issue is
> the order of calling. There is no way to call a function
> before doing the work in the argument list. If I call f(1+2),
> I can be sure the computation to get 3 will be performed
> _before_ calling f. The issue with f($p=array()) is that
> "$p=array()" is an r-value.
>
> - Todd
>
> On Mon, 2006-07-24 at 19:16 +0200, Johannes Schlueter wrote:
> > Hi,
> >
> > On Monday 24 July 2006 17:52, Rishad Omar wrote:
> > > getArray($p = array());
> >
> > Here you are relying on undefined behavior. It is not defined wether $p
=
> > array() or the function call getarray($p) should be executed first so
the