Difference between revisions of "Array unique recursive - PHP"

From List Wiki, organize pieces together
Jump to: navigation, search

(Created page with "==❓ How to perform array_unique on a multidimensional array recursively?== ===πŸ’‘ Solution=== <syntaxhighlight lang="PHP"> function array_unique_recursive(&$arr){ $arr = a...")
(No difference)

Revision as of 14:43, 9 July 2019

❓ How to perform array_unique on a multidimensional array recursively?

πŸ’‘ Solution

function array_unique_recursive(&$arr){
	$arr = array_unique($arr, SORT_REGULAR);
	foreach ($arr as &$t){
		if (is_array($t)) $t = aa($t);
	}
	return $arr;
}
array_unique_recursive($yourArray);

πŸ’¬ Discussions

πŸ“– Notes

  • You can help to provide additional answer to this question.

🌎 Navigations

Category frequently asked questions - PHP not found

πŸ” More information

🐢 References