Q:

Where does $_SESSION get stored?

When logging in from iphone app, I call a php script login function that stores a session of the user id. Does this Id get stored on the server or on the iphone?
  $_SESSION['IdUser'] = $result['result'][0]['IdUser'];

The reason I'm asking is b/c the session is apparently not being stored when I exit the simulator and start it back up so I believe it's being stored on the server. Would I want the session to be stored on the server if I expect multiple users to be on my app at once or would it be better on the client? How does the server know/get the session id from the client? Thanks.
Also I want my users to stay logged in. Obviously.

A:

The PHP Documentation on Sessions is pretty clear about this, but I'll summarize:

$_SESSION is stored on the server.  It's actually in a temporary file that has the session name (usually).
The server identifies the user's session via a cookie

If it's easy for you to have the device send the corresponding session cookie with each request (as would happen with a website) then server storage is fine for you.  Otherwise, you may want to use local storage.  There's no concern about multiple users' sessions overriding each other.

