FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » simple session question
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: OT: and even in Dart .........Re: simple session question [message #175757 is a reply to message #175744] Sun, 23 October 2011 15:12 Go to previous messageGo to previous message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma:
Senior Member
Norman Peelman schrieb:
>> [1] Evaluate the expression $foo++ (result: 0, side effect: $foo = 1)
>> [2] Assign the result to $foo ($foo = 0)

> But when you echo $foo on the next line it should equal 1. It's a race
> condition as 0 is held in a temporary buffer, $foo is incremented, and
> then $foo is assigned the temporary buffer. Thereby overwriting the
> increment.

And thus, echoing $foo should print 0. The temporary buffer is 0 and in
[2] $foo is assigned this value, "overwriting the increment" as you
write correctly. So why do you say that a subsequent echo $foo should
print 1? And in the above scenario there is no race condition involved.
There must be a misunderstanding of what you wrote on my part here.

>> Yes, it means that the expression $foo++ evaluates to the value which
>> $foo had before. And it is this value which is assigned to $foo after
>> the $foo++ step is completed.

> Not really *before*, i'd say *current* value.

Yes.

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: session cookie: client side
Next Topic: by get this format my explode file name like this through php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 07 22:48:13 GMT 2024

Total time taken to generate the page: 0.04690 seconds