Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 885391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:54:17+00:00 2026-05-15T12:54:17+00:00

I have a function which must return one dimensional associate array, like $user_info[$index]=value where

  • 0

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:

  1. Is it OK to have such an array if to take into account performance of the application?
  2. 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.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:54:18+00:00Added an answer on May 15, 2026 at 12:54 pm

    You have a long key in an associative array.

    I don’t think it’s a problem. If you wanted to shorten it you could hash your key-value and store the value with the hashed value.

    That being said, have you asked yourself why you’re using that schema? Might it be better to come up with a different data structure to suit your needs?

    I’d be much more concerned with the amount of data (size of the array) that you’re storing in the session variable. I think using the session to store data like this is a bad idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class which must return a CGRect from one of its methods:
hi i have function which is called by tinker listbox so i cannot return
Can I´m asking for advice. I have function which should return javascript object function
I have a function which looks something like this, it returns a noncopyable class
I have a function which is described in one of my controllers. The function
I have a function which is like $(function() { var data = [ {
I have a function pointer array which I use to call the appropriate cblas_xgemm
I have a function which works a very slow for my task (it must
I have a array which contains values like this See below for script sample
For example, I have a class that has two strings, one of which must

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.