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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:11:30+00:00 2026-05-15T07:11:30+00:00

Not sure how to go about this… But, I have two arrays, one with

  • 0

Not sure how to go about this…

But, I have two arrays, one with updated information, another with outdated information… There are a lot more elements in the second array, but I’m looking to “update” the outdated one with the updated information.

Here’s what the arrays look like:

//Outdated
Array (
    [0] => Array
        (
            [anum] => 3236468462
            [cid] => 4899097762
            [mid] => 1104881401  
            [na_title] =>         
            [na_fname] => JOHN                   
            [m_initial] =>  
            [na_lname] => DOE           
            [na_suffix] =>     
            [na_addr1] => 1234 SAMPLE AVENUE           
            [na_addr2] =>                             
            [na_city] => NORWALK           
            [state] => OH
            [zip] => 
            [zip_plus_4] => 
            [route] => R002
            [dma_code] => 510334
        )
)


//Updated
Array (
    [1] => Array
        (
            [0] => YUD990
            [1] => 98
            [2] => 1234 Sample Avenue
            [3] => 
            [4] => Norwalk
            [5] => OH
            [6] => 44857-9215
            [7] => 3236468462
        )
)

To clarify, I want to:

(1) Match up the value for [7] from the updated array with the value for [anum] in the outdated array, and then update [na_addr1], [na_addr2], [na_city], [state], [zip], [zip_plus_4] in the outdated array with the values for [2],[3],[4],[5],[6] (I know I’ll need to split the updated [6] in order to get it to map corrected to the outdated)

Feel like I’m making this very confusing… sorry about that…

  • 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-15T07:11:30+00:00Added an answer on May 15, 2026 at 7:11 am

    Assuming that the structure of the update array will never change, you could just use the code below. (I’m assuming that ‘zip’ is the first 5 digits and zip_plus_4 is the last 4 digits, but I’m not clear exactly what they’re supposed to be.)

    $old_array['anum'] = $new_array[7];
    $old_array['na_addr1'] = $new_array[2];
    $old_array['na_addr2'] = $new_array[2];
    $old_array['na_city'] = $new_array[3];
    $old_array['state'] = $new_array[4];
    $zip_code = explode('-', $new_array[6]);
    $old_array['zip'] = $zip_code[0];
    $old_array['zip_plus_4'] = $zip_code[1];
    

    I’m not sure why the second array doesn’t use its own set of matching keys. It would be more readable and help keeps things consistent. For example, if you end up adding another field, some of the elements could be offset by one, which would just cause headaches. But if the arrays used the same keys, you could use the code below and everything would be fine.

    $old_array['anum'] = $new_array['anum'];
    $old_array['na_addr1'] = $new_array['na_addr1'];
    (etc)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I know javascript pretty well, but I'm not sure about this one. Tough
Erhm - not sure about this one. But here goes :) I want a
I'm fairly new to C++, and I'm not sure about this one. Have a
Im not sure about the best way to do this but I have a
I am not sure if I am going about this the best way, but
I am not sure about this, but I think I read it before, and
I am not sure about this, but a client of me asked that he
I am not sure about this, but does setting a core data object to
This might be easy but i am not sure about this as on beginner
I am not professional programmer so i can not be sure about this.How many

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.