Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php :: one function to do array_unique(array_merge($a,$b));

Tags:

arrays

php

I am aware that I can use array_unique(array_merge($a,$b));

to merge two arrays and then remove any duplicates,

but,

is there an individual function that will do this for me?

(I know I could write one myself that just calls these, but I am just wondering).

like image 286
Hailwood Avatar asked Nov 04 '10 21:11

Hailwood


1 Answers

There is no such function. Programming languages in general give you a certain set of tools (functions) and you can then combine them to get the results you want.

There really is no point in creating a new function for every use case there is, unless it is a very common use case - and yours does not seem to be one.

like image 123
Anti Veeranna Avatar answered Sep 27 '22 19:09

Anti Veeranna