class TestClass { function TestClass() { $this->field = 1000; } }
function returnAnObject() { $obj = new TestClass; return $obj; }
echo returnAnObject()->field;
- - - - - - - -
Now, explain to me why it is that the last item in $a is incremented twice, while all the others are only incremented once?
Sure (after some fiddling around). As you enter the second foreach loop, $b contains a reference to the last member of the array because that's how the previous foreach left things. Therefore, for each iteration, what you are saying is this: Make the last member of the array ($a[3] as referenced by $b) equal to the current member of the array, plus one.
If $b added 1 to itself (as might be expected) then the value would end up being 9. What seems to be happening in the second loop is: $a[3] = $a[n] + 1, not $a[3] += 1
I don't know if that behaviour is right or wrong in a formal sense.
"Everyone in the civilized world knew that Iraq was bombed to stone age on Gulf war"
Actually, this isn't true. WMD elements were being destroyed in the mid nineties by the U.N (who only found some of it after information was received from defectors). Foreign intelligence agencies (not simply U.S and U.K.) were telling their governments that Sadam had most likely NOT destroyed all the gear.
Not that it was ever a really good idea to invade.
This works fine in PHP 5.1.4: - - - - - - - -
Now, explain to me why it is that the last item in $a is incremented twice, while all the others are only incremented once?
Sure (after some fiddling around). As you enter the second foreach loop, $b contains a reference to the last member of the array because that's how the previous foreach left things. Therefore, for each iteration, what you are saying is this: Make the last member of the array ($a[3] as referenced by $b) equal to the current member of the array, plus one.
If $b added 1 to itself (as might be expected) then the value would end up being 9. What seems to be happening in the second loop is: $a[3] = $a[n] + 1, not $a[3] += 1
I don't know if that behaviour is right or wrong in a formal sense.
Register Globals has been off by default for years.
Please don't let us see the return of \'magic quotes\'
"Everyone in the civilized world knew that Iraq was bombed to stone age on Gulf war"
Actually, this isn't true. WMD elements were being destroyed in the mid nineties by the U.N (who only found some of it after information was received from defectors).
Foreign intelligence agencies (not simply U.S and U.K.) were telling their governments that Sadam had most likely NOT destroyed all the gear.
Not that it was ever a really good idea to invade.
http://www.antivirus.comodo.com/ But read this http://www.emailbattles.com/archive/battles/securi ty_aadgdfdddh_ah/