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
143 Like 34 Dislike
Previous forums Next forums
Other forums

ctype() validation - allowing illegal characters
Hello,
I use ctype() to filter and validate a user form. However, I am trying to allow certain c

Display certain image depending on time of year
Hi, I am new to these forums and would really appreciate some advice on a piece of coding I have don

Get dump of MySQL DB from Live Site
I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server.

Allegro crashes when running load_bitmap. Why?
I can not get Allegro to load any BMP images. Here is a section of test code. The picture is in the

update the selected existing records of database
Hi frndz,
I am new to php and get stuck....

Edit.php > Update.php > Updatea

Login Issue's
Code: <?php
$file = fopen('user.txt', 'r');

/* Set login to false initially */

Can anyone give me some link on .htaccess tutorial
i wish to have friendly url using .htaccess, but no idea yet about this

Hope that anyone cou

Any Good MMORPGs you've played?
I'm about to have ALOT of free time on my hands (finished highschool) and I need something to fill t

adding 0 to numbers
Hey guys i need to create a 00001 number in a loop. Is there a better way of forcing a 5 digit numbe

Regular expression tips or resources
Hello! I'm having some issues implementing the appropriate regex patter to eliminate unwanted charac

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