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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:32:14+00:00 2026-06-02T08:32:14+00:00

I am using the Solr search engine. It returns my search results like so:

  • 0

I am using the Solr search engine. It returns my search results like so:

array(2) {
  ["responseHeader"]=>
  array(3) {
    ["status"]=>
    int(0)
    ["QTime"]=>
    int(1)
    ["params"]=>
    array(5) {
      ["wt"]=>
      string(3) "php"
      ["start"]=>
      string(1) "0"
      ["q"]=>
      string(7) "monitor"
      ["version"]=>
      string(3) "2.2"
      ["rows"]=>
      string(2) "10"
    }
  }
  ["response"]=>
  array(3) {
    ["numFound"]=>
    int(2)
    ["start"]=>
    int(0)
    ["docs"]=>
    array(2) {
      [0]=>
      array(11) {
        ["id"]=>
        string(6) "VA902B"
        ["name"]=>
        string(49) "ViewSonic VA902B - flat panel display - TFT - 19""
        ["manu"]=>
        string(15) "ViewSonic Corp."
        ["weight"]=>
        float(190.4)
        ["price"]=>
        float(279.95)
        ["price_c"]=>
        string(10) "279.95,USD"
        ["popularity"]=>
        int(6)
        ["inStock"]=>
        bool(true)
        ["store"]=>
        string(18) "45.17614,-93.87341"
        ["cat"]=>
        array(2) {
          [0]=>
          string(11) "electronics"
          [1]=>
          string(7) "monitor"
        }
        ["features"]=>
        array(1) {
          [0]=>
          string(75) "19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution"
        }
      }
      [1]=>
      array(12) {
        ["id"]=>
        string(7) "3007WFP"
        ["name"]=>
        string(34) "Dell Widescreen UltraSharp 3007WFP"
        ["manu"]=>
        string(10) "Dell, Inc."
        ["includes"]=>
        string(9) "USB cable"
        ["weight"]=>
        float(401.6)
        ["price"]=>
        float(2199)
        ["price_c"]=>
        string(8) "2199,USD"
        ["popularity"]=>
        int(6)
        ["inStock"]=>
        bool(true)
        ["store"]=>
        string(18) "43.17614,-90.57341"
        ["cat"]=>
        array(2) {
          [0]=>
          string(11) "electronics"
          [1]=>
          string(7) "monitor"
        }
        ["features"]=>
        array(1) {
          [0]=>
          string(71) "30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast"
        }
      }
    }
  }
}

I am capturing this response inside a variable called $results. On my page I am doing a vardump to get each result set like so:

foreach($results['response'] as $result) {
    if(is_array($result)) {
        foreach($result as $v) {
            var_dump($v);   
        }
    }
}

This is the output of that:

array(11) {
  ["id"]=>
  string(6) "VA902B"
  ["name"]=>
  string(49) "ViewSonic VA902B - flat panel display - TFT - 19""
  ["manu"]=>
  string(15) "ViewSonic Corp."
  ["weight"]=>
  float(190.4)
  ["price"]=>
  float(279.95)
  ["price_c"]=>
  string(10) "279.95,USD"
  ["popularity"]=>
  int(6)
  ["inStock"]=>
  bool(true)
  ["store"]=>
  string(18) "45.17614,-93.87341"
  ["cat"]=>
  array(2) {
    [0]=>
    string(11) "electronics"
    [1]=>
    string(7) "monitor"
  }
  ["features"]=>
  array(1) {
    [0]=>
    string(75) "19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution"
  }
}

array(12) {
  ["id"]=>
  string(7) "3007WFP"
  ["name"]=>
  string(34) "Dell Widescreen UltraSharp 3007WFP"
  ["manu"]=>
  string(10) "Dell, Inc."
  ["includes"]=>
  string(9) "USB cable"
  ["weight"]=>
  float(401.6)
  ["price"]=>
  float(2199)
  ["price_c"]=>
  string(8) "2199,USD"
  ["popularity"]=>
  int(6)
  ["inStock"]=>
  bool(true)
  ["store"]=>
  string(18) "43.17614,-90.57341"
  ["cat"]=>
  array(2) {
    [0]=>
    string(11) "electronics"
    [1]=>
    string(7) "monitor"
  }
  ["features"]=>
  array(1) {
    [0]=>
    string(71) "30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast"
  }
}

This is exactly what I need but I was wondering if there is a more elegent way to get it than my “nested foreach loop and is array check” approach.

  • 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-02T08:32:16+00:00Added an answer on June 2, 2026 at 8:32 am
    foreach ($results['response']['docs'] as $result) {
       ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using solr search engine to query an index for classifieds that match
We are using SOLR as our search engine. When I search for a product,
I am using ajax-solr to generate search results from Solr. Is there any way
I'm having a problem with Solr 3.4, I'm using it's spacial search functions like
I am trying to setup a search engine using Solr (or Lucene) which could
i am using solr 1.4.1 for building a distributed search engine, but i dont
I'm using Solr to search for a long list of IDs like so: ID:(4d0dbdd9-d6e1-b3a4-490a-6a9d98e276be
I have been using solr search and now I am adding pagination via the
I am completely new to java and I am using Solr search server. It
I'm using Solr as a search frontend to a large corpus of music artist

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.