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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:48:27+00:00 2026-05-22T16:48:27+00:00

I have an array within an array within an array and so on: array(3)

  • 0

I have an array within an array within an array and so on:

array(3) {
    [0]=> array(1) {
        ["weather"]=> array(2) {
            ["ID"]=> string(1) "1"
            ["weather_types"]=> string(5) "Clear"
        }
    }
    [1]=> array(1) {
        ["weather"]=> array(2) {
            ["ID"]=> string(1) "2"
            ["weather_types"]=> string(6) "Clouds"
        }
    }
    [2]=> array(1) {
        ["weather"]=> array(2) {
            ["ID"]=> string(1) "3"
            ["weather_types"]=> string(4) "Rain"
        }
    }
} 

I will assign as a variable, let’s use:
$select_item

and then have the weather_types strings, “Clear”, “Cloudy”, and “Rain” w/o quotes be the only data that appears in my select/option list.

I need to somehow remove all the other array data so that “Clear”, “Cloudy”, and “Rain” is left.

then I will save the selected option to the database table.

  • 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-05-22T16:48:28+00:00Added an answer on May 22, 2026 at 4:48 pm

    Assuming $weather is the array and you want the value attribute to contain ID. Either way, adjusting the following to your needs should be trivial.

    foreach ($weather as $select_item) {
      echo '<option value="', $select_item['weather']['ID'], '">', $select_item['weather']['weather_types'], '</option>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would I use the include() function within an array? For example, I have
I want to have an variable-length array contained within a structure, but am having
I have an array within an array. $a = array ( 0 => array
I have an array of values all well within the range 0 - 63,
I have a multidimensional array, and I would have multiple arrays within it. Some
An array is defined of assumed elements like I have array like String[] strArray
Let's say I have array of bytes: byte[] arr = new byte[] { 0,
I'm playing about with a stop words within my code I have an array
I have an array within an array that contains settings. I need to figure
I have the following issue, I have an array with the name $data Within

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.