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 7828805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:29:27+00:00 2026-06-02T10:29:27+00:00

Wondering whether any improvement can be done to speed up this array? test array

  • 0

Wondering whether any improvement can be done to speed up this array?

test array row count is 40,000 record.

it took very long time for the loop to be completed.

sample value:

$test[] = array(
    'products_id' => $data['products_id'],
    'products_extra_fields_id' => $data['products_extra_fields_id'],
    'products_extra_fields_name' => $data['products_extra_fields_name'],
    'products_extra_fields_value' => $data['products_extra_fields_value']
    );



foreach productid
{

  $colname="column name";


    //this inside for loop making thing very slow
    foreach ($test as $key1 => $row1)
    {
        $w= $row1['products_id'];
        $x= $row1['products_extra_fields_id'];
        $y= $row1['products_extra_fields_name'];
        $z= $row1['products_extra_fields_value'];

        if( ($w==$products_id) && ($y== $colname) )
        {
            $wantedvalue=$z;
            break;
        }
    }

}
  • 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-02T10:29:28+00:00Added an answer on June 2, 2026 at 10:29 am
    1. You can build the array $test[] as dictionary (user products_id . “_” . products_extra_fields_name as key)

      $test[$data[‘products_id’] .”_”.$data[‘products_extra_fields_name’]] = array(
      ‘products_id’ => $data[‘products_id’],
      ‘products_extra_fields_id’ => $data[‘products_extra_fields_id’],
      ‘products_extra_fields_name’ => $data[‘products_extra_fields_name’],
      ‘products_extra_fields_value’ => $data[‘products_extra_fields_value’]
      );

    Once you do this, you can directly index the array since you already have column name and products_id

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

Sidebar

Related Questions

I was wondering whether anyone had any recommendations regarding populating multiple view models on
I was wondering whether anyone knows of any tools available that perform the task
I was wondering if any of you could give me guidance on whether it'd
I wondering whether use a webView to create a complex text area done with
I am wondering whether I can upgrade a basic IoC container I am using
I am wondering whether there is any way to achieve partial JSP rendering in
I was wondering whether there's any advantages to using a static member function when
I was wondering whether there is any performance / advantage of writing javascript in
I was wondering whether there is any way to create custom Orders statuses in
I was wondering whether there is any associated performance problems with using only one

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.