This answer is based on this answer. Cha uses arrays in storing login -info in contrast to my code.
It likely improves the efficiency in searching the login -data and keeps your data organized. However, I am not sure whether this is the best data structure in storing all pieces of the login info.
My solution always fetches passhash from the database when needing the info and then destroyes it after the use, instead of storing it to the array in PHP for session. It also keeps all variables as independent variables. It uses heavily PostgreSQL in contrast of data manipulation by a scripting language.
Which are the pros and cons of using arrays in PHP for storing login data?
[edit]
I use the following code at the moment in getting the data from the database.
$result = pg_prepare($dbconn, "query22", "SELECT passhash_md5 FROM users
WHERE email=$1;");
$passhash_md5 = pg_execute($dbconn, "query22", array($_REQUEST['email']));
So it should be changed to PDO to make it better. Studying that.