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;
$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

mysql VARCHAR acting like INT
Hi, All.

I have a table that contains a varchar(10) column named weird_field. In this column

getting most records by count
Code: [Select]<?php

$connect = mysql_connect("localhost","dam

Probably a simple error...
I'm getting the error -- Parse error: syntax error, unexpected '{' in /home/content/c/s/t/csteffen24

cURL Upload Help
OK, I am creating a bridge from a local program to my website and I am trying to find the best way t

wav to mp3 + goDaddy
I need to convert wav files to mp3s. From what I have found so far one way to do it is to have my PH

Passing PHP variables from one page to another
Hello-

I'm having trouble figuring out how to transport a variable from one php file to anoth

Record count of entire database
Does anyone know if there is a way to obtain the number of records in each table of the database usi

making web pages for accounts
Hello, I would like to make pages for accounts on my website im making (its not a real website..im j

Binding 2 UDP sockets on same port, connected to different destinations, 1 receives
Hello,
My application wants to send/recv data to 2 different UDP ports on a remote computer, us

TemplatePower & AJAX
Hi all,



I'm currently implementing some AJAX features in my PHP-framework (which is b

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