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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:37:14+00:00 2026-06-13T19:37:14+00:00

I have an array called $array which contains entries like this: Array ( [2340]

  • 0

I have an array called $array which contains entries like this:

Array ( 
  [2340] => Array ( 
     [cv] => Array ( 
       [size] => 317613
       [c] => 3 ) ) 
  [16410] => Array ( 
     [cv] => Array ( 
       [size] => 119808 
       [c] => 1 ) ) 
)

I am using the below and everything works except the first value – I need it to display 2340 in the first iteration and then 16410 in the second where I have $row[0] below:

foreach ($array as $row) {
  print $row[0];
  print($row[cv][size]);
  print($row[cv][c]);
}

How do I access that first ID?

  • 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-13T19:37:15+00:00Added an answer on June 13, 2026 at 7:37 pm

    Use this…

    foreach ($array as $first_value => $row) {
        print $first_value;
        print($row[cv][size]);
        print($row[cv][c]);
    }
    

    … instead (as ‘first value’ you’re talking about is actually an index of the element processed).

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

Sidebar

Related Questions

I have an array (called array in the code below) which contains a number
I have an array of objects called objarray . Each object looks like this:
I have a class called XYZ inheriting from NSObject and an array which contains
I have an NSMutableArray called myObjectArray which contains and array of NSObjects called myObject.
I have a custom class in Obj-C called RouteManager which contains an array of
I have a file called layout.php which contains <?php $arrLayout = array( section1 =>
I have an array which contains numbers like 331,554,22 or it could be 45,
I have a array called $A which contains only non zero positive numbers. Now
I have an array called dbRecipes which contains a list of recipes divided into
I have a Javascript object called TweenManager which contains an array of Tween objects.

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.