Skip to content

How to add two array in single array without repetation in PHP?

<?php
	$array1=array("CPU","Mouse","Monitor");
	$array2=array("Key-Board","Monitor","Printer");
	$array = array_unique(array_merge($array1, $array2));
	print_r($array);
?>
See also  How to initialize an array in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.