# \[PHP\] remove one array from another

**URL:** <https://forum.kirupa.com/t/php-remove-one-array-from-another/63152>\
**Category:** programming\
**Created:** [September 3, 2004, 9:26am UTC](https://forum.kirupa.com/t/php-remove-one-array-from-another/63152 "2004-09-03T09:26:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![koorb](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/koorb/32/424_2.png) [@koorb](https://forum.kirupa.com/u/koorb)\
**Post date:** [September 3, 2004, 9:26am UTC](https://forum.kirupa.com/t/php-remove-one-array-from-another/63152/1 "2004-09-03T09:26:32Z")

</div>

for example:

$array1 = array(‘foo’, ‘bar’);  
$array2 = array(‘foo’, ‘bar’, ‘donkeywings’);

now I want to take the values of $array1 out of $array2, I know this can be done using while and in\_array etc. but is there an array function to this straight off, I have had a look on [php.net](http://php.net), but cant see anything, just wondered if anyone had something on the top of thier head.

thanks much…  
peace!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 3, 2004, 12:30pm UTC](https://forum.kirupa.com/t/php-remove-one-array-from-another/63152/2 "2004-09-03T12:30:31Z")

</div>

Try array\_diff
