Michael Sims wrote:
Jochem Maas wrote:
Michael Sims wrote:
So, as far as foo() knows:
foo($a = 5);
and
foo(5);
are exactly the same...
I don't think they are, and you're examples don't prove it.
Anyone care to come up with the proof.
No, I was wrong, Rasmus corrected me. That's my on
> Jochem Maas wrote:
> > Michael Sims wrote:
> >> So, as far as foo() knows:
> >>
> >> foo($a = 5);
> >> and
> >> foo(5);
> >>
> >> are exactly the same...
> >
> > I don't think they are, and you're examples don't prove it.
> > Anyone care to come up with the proof.
>
> No, I was wrong, Rasmus cor
Jochem Maas wrote:
> Michael Sims wrote:
>> So, as far as foo() knows:
>>
>> foo($a = 5);
>> and
>> foo(5);
>>
>> are exactly the same...
>
> I don't think they are, and you're examples don't prove it.
> Anyone care to come up with the proof.
No, I was wrong, Rasmus corrected me. That's my on
Michael Sims wrote:
Jochem Maas wrote:
foo($a = 5);
by definition the expression is evaluated _before_ the function is
called - so the expression is not passed to the function, the result
of the expression is passed ... I was under the impression that the
the expression evaluates to a 'pointe
Rasmus Lerdorf wrote:
> Michael Sims wrote:
>> When used as an expression, an assignment evaluates to whatever is
>> on the right side of the assignment operator, not the left.
>> Example:
[...]
>> foo($a = 5);
>> and
>> foo(5);
>>
>> are exactly the same...
>
> The value passed is the same, b
Michael Sims wrote:
> Jochem Maas wrote:
>
foo($a = 5);
>>
>>by definition the expression is evaluated _before_ the function is
>>called - so the expression is not passed to the function, the result
>>of the expression is passed ... I was under the impression that the
>>the expression evaluate
Lester Caine wrote:
> This type of code is used in a few places, so I'd like a little help
> converting it to 'good code' under the new rules ;)
>
> Get the key from an array ( fails because key(&array) )
>
> if( $pId == key( $this->getFunc() ) ) {
>
> In getFunc()
>
> return ( $this->g
thanks everyone for the crash course in better understanding the underlying
mechanisms!
... I'm probably not the only one that learnt something from this ;-)
Dragan Stanojevic - Nevidljivi wrote:
Jochem Maas wrote:
Basically, in PHP, a reference (such as what key() takes as a
parameter [1]) c
Jochem Maas wrote:
Basically, in PHP, a reference (such as what key() takes as a
parameter [1]) can only point to an actual variable, not directly to
the result of a function. So you have to assign the output of the
function to a variable first.
wtf, Im now officially confused (before I suffer
Jochem Maas wrote:
>>> foo($a = 5);
>
> by definition the expression is evaluated _before_ the function is
> called - so the expression is not passed to the function, the result
> of the expression is passed ... I was under the impression that the
> the expression evaluates to a 'pointer' (I'm sur
Jasper Bryant-Greene wrote:
Jochem Maas wrote:
Jasper Bryant-Greene wrote:
From the PHP manual [2]:
| the following examples of passing by reference are invalid:
|
| foo(bar()); // Produces fatal error since PHP 5.1.0
| foo($a = 5); // Expression, not variable
if foo() expects one args by
Jochem Maas wrote:
Jasper Bryant-Greene wrote:
From the PHP manual [2]:
| the following examples of passing by reference are invalid:
|
| foo(bar()); // Produces fatal error since PHP 5.1.0
| foo($a = 5); // Expression, not variable
if foo() expects one args by reference then why is doing:
f
Jasper Bryant-Greene wrote:
Lester Caine wrote:
I suppose the REAL questions was - "Why was using the function in this
way a 'bad practice', is there any way that it could be made a 'good
practice' since the intent is so obvious?"
I understand the new checks, but I don't see that the original
Lester Caine wrote:
I suppose the REAL questions was - "Why was using the function in this
way a 'bad practice', is there any way that it could be made a 'good
practice' since the intent is so obvious?"
I understand the new checks, but I don't see that the original was
particularly 'bad' - only
Jasper Bryant-Greene wrote:
Lester Caine wrote:
This type of code is used in a few places, so I'd like a little help
converting it to 'good code' under the new rules ;)
They're not "new rules". PHP is just warning you where it didn't before.
It was still bad coding practice before.
Since
Lester Caine wrote:
This type of code is used in a few places, so I'd like a little help
converting it to 'good code' under the new rules ;)
They're not "new rules". PHP is just warning you where it didn't before.
It was still bad coding practice before.
Get the key from an array ( fails b
16 matches
Mail list logo