<?php $input = [ ["blue", "red", "green", "yellow"], ["pink", "blue", "red"], ["black", "pink", "yellow"] ]; $uniques = []; foreach ($input as $array) { $uniques = array_merge($uniques, $array); } $uniques = array_unique($uniques); var_dump($uniques);