I have a function which must return one dimensional associate array, like $user_info[$index]=value
where $index
is a string which consist of
- user_id
- full_name
- photo_file_name
for example, my associative array could look like $user_info['user-123456789~~Bill Gates~~bill_gates.png'
]=$value. I need user_id, full_name and photo for another needs, in order to know whose value is this and what is his full name, etc.
So, the questions that has risen are following:
- Is it OK to have such an array if to take into account performance of the application?
- If it is bad (I think that it is bad idea) so how can I solve my problem in this case.
Additional info. This function retrieves user information into this associative array and returns this array. Further, my application stores it in a session in order to address it and retrieve information right from the session variable, not execute once again a query. And finally the reason I need one dimensional array is that I use a function array_diff
where one of the arrays are $user_info
array.
Note, Take into account that one user could have 1 or many values.
Any suggestions would be pleased.