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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:45:59+00:00 2026-05-23T15:45:59+00:00

array(3) { [0]=> array(4) { [Field1]=> string(8) 80000007 [Field2]=> string(16) O70000006 [Field3]=> string(0) [Field4]=>12345

  • 0
array(3) {
  [0]=>
  array(4) {
    ["Field1"]=>
    string(8) "80000007"
    ["Field2"]=>
    string(16) "O70000006"
    ["Field3"]=>
    string(0) ""
    ["Field4"]=>12345
    string(0) ""
   }
  [1]=>
  array(4) {
    ["Field1"]=>
    string(8) "80000008"
    ["Field2"]=>
    string(16) "O70000007"
    ["Field3"]=>
    string(0) ""
    ["Field4"]=>78965
    string(0) ""
  }
  [2]=>
   array(4) {
    ["Field1"]=>
    string(8) "80000009"
    ["Field2"]=>
    string(16) "H80000006"
    ["Field3"]=>
    string(0) ""
    ["Field4"]=>12345
    string(0) ""
  }
}

I have the above array i want to store this items of array into another temp array and use it . Here is what iam doing

 $arr_tmp = array();
foreach ($result['record'] as $key => $value){
                $arr_tmp['Field1'] =  $value['Field1'];
                $arr_tmp['Field2'] =  $value['Field2'];
                $arr_tmp['Field3'] =  $value['Field3'];
                $arr_tmp['Field4'] =  $value['Field4'];
}

when i do var_dump($arr_tmp). Iam getting only the last record in the array. I need the same result set in this $arr_tmp when using foreach loop so that i can add some more items to this array .

  • 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-23T15:45:59+00:00Added an answer on May 23, 2026 at 3:45 pm

    You’ve only created a single arr_tmp array, and overwrite the values on each loop iteration. Possibly you’d want something like:

    $arr_tmp[] = array('Field1' => $value['Field1'], 'Field2' => $value['Field2'], etc...)
    

    inside the loop instead.

    But, unless I’m reading your original array wrong, this will simply re-create the original array with new keys, so that begs the question… why? Wouldn’t it be easier to just do:

    $arr_tmp = $original_array;
    

    ?

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

Sidebar

Related Questions

I have a string with text inside curlies like this: {field1}-{field}+{field3}Anthing{field4} from which I
Say I have an array like so in my code behind: public static string[]
Let's say I have a string array of field internal names. How do I
I have some problem to order an array by a field of this, here
I have an array of structs and one of the fields in the struct
I have an array that I would like to sort using a date field
I have the code below. The line string content = twitterMsg.text; is creating the
How to extract and save array from string parameter? I'm trying convert string beafore_create
// Take an array to store all string. NSMutableArray *allRows = [[[NSMutableArray alloc] init]
Using VB.net (.net 2.0) I have a string in this format: record1_field1,record1_field2,record2_field3,record2_field1,record2_field2, etc... I

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.