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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:19:38+00:00 2026-06-17T14:19:38+00:00

Here are the arrays. Array1 ( [439] => dsaffsdfdfdfsffdsf [379] => 3454 [375] =>

  • 0

Here are the arrays.

Array1
(
[439] => dsaffsdfdfdfsffdsf
[379] => 3454
[375] => 3 ///why is it removed in the resulting array?
[436] => Fdsafdfsdf
[432] => 3  /// this one too
[431] => 2
[385] => 499
[434] => 3501
[435] => 2013-01-16
[430] => 1
[440] => fsdzsdaffdsfffdsf
[406] => YES
[438] => 32442344324324234
[376] => 3
)

Array2
(
[376] => 3
[385] => 499
)

array_diff(array1, array2)

result
(
[439] => dsaffsdfdfdfsffdsf
[379] => 3454
[436] => Fdsafdfsdf
[431] => 2
[434] => 3501
[435] => 2013-01-16
[430] => 1
[440] => fsdzsdaffdsfffdsf
[406] => YES
[438] => 32442344324324234
)

Looks weird to me. Any idea? Its removing based on value?

I just want Array2 elements removed from Array1

  • 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-17T14:19:39+00:00Added an answer on June 17, 2026 at 2:19 pm

    Manual is your best friend:

    • array_diff() Compares array1 against array2 and returns the difference.
    • array_diff_assoc() Compares array1 against array2 and returns the difference. Unlike array_diff() the array keys are also used in the comparison.
    • array_diff_key() Compares the keys from array1 against the keys from array2 and returns the difference. This function is like array_diff() except the comparison is done on the keys instead of the values.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two arrays: $array1 = array(1=>1,10=>1,12=>0,13=>13); $array2 = array(1=>Hello,10=>Test,12=>check,13=>error); Here $array1 has keys
my web-service return me an array composed of two arrays, here how it looks
I have a situation here, I have two arrays,array1 and array2 and one tableview.
Here's my (code golf) challenge: Take two arrays of bytes and determine if the
I have a problem using JSON and arrays. Here is my code: while($row =
I'm trying to follow the steps found here on comparing two arrays, and knowing
Here's an example of what I mean: I have an array: array('type'=>'text', 'class'=>'input', 'name'=>'username',
So i have a class name repository which is just a simple array.Here is
if($err) $_SESSION['msg']['login-err'] = implode('<br />',$err); Three quick questions: Why use a two-dimensional array here?
$.getJSON(./data/revenue-item-data.php,{val:'val'},function(data){ $('#totalUnits').val(data[0].SUM(item_qty)); $('#totalAmounts').val(data[0].SUM(DISTINCT net_total)); }); Here is array I get for above code: [{SUM(item_qty):68,SUM(DISTINCT

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.