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

  • SEARCH
  • Home
  • 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 8652315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:16:51+00:00 2026-06-12T14:16:51+00:00

I am gathering error messages for records based on their ids, e.g. in the

  • 0

I am gathering error messages for records based on their ids, e.g. in the following code the id “2342” has two errors. After collecting these, how can I get “all errors for a specific id” without looping through all array items and testing for that id?

$errorMessages = [];
$errorMessages[] = ['2342','error1'];
$errorMessages[] = ['1236','error2'];
$errorMessages[] = ['2342','error3'];
$errorMessages[] = ['6535','error4'];

//get all error messages that belong to e.g. id=2342 in an array 

An alternative would be to save the array as, e.g.:

$errorMessages['2342'] = 'error1';

But then the second time I add a message to the id=’2342′, the value is replaced instead of added, so this is not an option.

What is the best way to save multiple strings like this to an array, and then be able to retrieve all strings for a specific array quickly?

  • 1 1 Answer
  • 0 Views
  • 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-06-12T14:16:52+00:00Added an answer on June 12, 2026 at 2:16 pm

    simply use an multi dimensional array and store an array of messages of the same id

    $errorMessages['2342'][] = 'error1';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In general the SDLC has the following phase requirement gathering design coding testing deployment
My hosting company is now saying that their (8)Exec format error: exec of '/home/
Is there any tool like ELMAH for error gathering of an ASP.NET MVC that,
This is my code of a sample details gathering page,where once the customer enters
I have a data gathering app (terrestrial magnetic field strength) that has four phases;
If gathering requirements for a medium-to-large web-based project, at what point should one consider
I am gathering all the routed events fired for the MouseRightDownButton and storing them
Need some help gathering thoughts on this issue. Our team is moving ahead with
I am gathering data from youtube's gdata API and would like to use the
I'm interesting in gathering usage metrics for an application that I did not write

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.