You can combine the array_merge()
function with the array_unique()
function (both titles are pretty self-explanatory)
$array = array_unique (array_merge ($array1, $array2));
More Related Contents:
- Combine two arrays
- How to combine two arrays together?
- How can you make a multidimensional array unique? [duplicate]
- What’s the difference between array_merge and array + array? [duplicate]
- PHP – Merge two arrays (same-length) into one associative?
- Merge row data from multiple arrays
- Merge two flat indexed arrays of equal size so that values are pushed into the result in an alternating fashion
- Merge arrays of associative arrays by shared column values
- Merge two indexed arrays of indexed arrays based on first column value
- PHP merge arrays by value
- Merge two 2d arrays by shared column value
- Merge two numerically-keyed associative arrays and preserve the original keys
- Group array values based on key in php? [duplicate]
- How to merge subarray values and remove duplicates?
- Get count of each unique value in one column of a 2d array
- How do search array values and remove them based on a condition or string? [closed]
- How to create an array from a CSV file using PHP and the fgetcsv function
- array_splice() for associative arrays
- Is it necessary to declare PHP array before adding values with []?
- Will copy-on-write prevent data duplication on arrays?
- use strings to access (potentially large) multidimensional arrays
- Nested array. Third level is disappearing
- Looping a multidimensional array in php
- More concise way to check to see if an array contains only numbers (integers)
- Is PHP’s count() function O(1) or O(n) for arrays?
- Convert a String to Variable
- How do I select 10 random things from a list in PHP?
- Push item to associative array in PHP
- PHP – How to send an array to another page?
- Implementing a simple lookup array