Remove values in array2 from array1


Posted on 16th Feb 2014 07:03 pm by admin

I have two arrays.

Array 1 is where the array key holds various different numbers. For example:
Code: [Select]$array[32] = 1;
Did you know?Explore Trending and Topic pages for more stories like this.
$array[122] = 1;
$array[238] = 1;
$array[324] = 1;

The other array holds values in the same way (but may have less values in total):
Code: [Select]$array[238] = 1;
$array[287] = 1;

I want to simply remove any values in array 2 from array 1 (so now array 1 simply holds 32, 122 and 324).

I am sure there is a quick array command that does this - so I won't need to use a foreach loop
No comments posted yet

Your Answer:

Login to answer
343 Like 46 Dislike
Previous forums Next forums
Other forums

md5 is it unique
I know this is most likely one of many simple questions that can be found semi easily. But I'm press

Posting Serialized Data Not Working
I am trying to send an object from one PHP file to another using POST. I serialize the object and th

need help modifying script
Hi guys,

I'm fairly new to php and am having a bit of trouble modifying a script.

This

Is it a good practice to store user info. in sessions?
I am making a user class for my script which stores all the user information in sessions. It takes u

Extracting Long text from message class with parameters
Hi,

I would like to extract the long text from a message class. However, the long text ha

Problem with creating FI documents
Hi, Experts!

when i create Fi doc. with standart transaction, i ve been had such problem

Add weeks in a query?
I have a SQL that summarizes the quantity per week. The weeks that has no value does not exist in th

single values into sql field
i have a form which i want the user to able to select multiple answers. But i want the answers to be

Menu restriction
How can I restrict the individual menu that would appear when a user logs in so that all users are c

Odd or Even
Inside of a while loop I need to echo several rows of info...easy enough.

In the loop (for th

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash