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

The Archive Base Latest Questions

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

Today i found new stack ( maybe stack with me ). I’m working for

  • 0

Today i found new stack ( maybe stack with me ). I’m working for a new simple PHP framework to learning, but when a need make a array of data to add to database. This array make from 2 array : one is Default array and one left is new request array. i will demo :

`

array $default = (
[cat] = '0',
[dog] = '0',
[bird] = '0'
)

array $request = (
[cat] = '10',
[dog] = '12',

[someanimal] = '100'
)

`

now i want make a new array with result like this: array $new = ([cat]='10', [dog]='12', [bird]='0').
In PHP may be have some command for this ? or we need make a custom function for?

Thanks everyone for help :).

  • 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-14T03:45:39+00:00Added an answer on June 14, 2026 at 3:45 am

    Try

    $result = $default;
    foreach ($request as $key=>$value) {
      if (isset($result[$key])) {
        $result[$key] = $value;
      }  
    }
    

    Or

    $result = array_intersect_key(array_merge($default, $request), $default)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Learning WPF nowadays. Found something new today with .Net dependency properties. What they bring
Today I've found that new library for pageflipper . But I don't know so
Ive just tryed some things out with my new server today, and ive found
I'm new to UNIX, having only started it at work today, but experienced with
I found this new feature in Chrome today. When you hover over the refresh
I'm fairly new to Android and today I fired it up and found a
I was attempting to use a new library today that I found on the
Today I was digging with TPL and found a new class Task.Now I just
I'm new to java and today I found JFrame also have the method paint
Today I need to create a new facebook app, since I need the app_id

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.