PHP Programs

Our aim is to connect students from campuses all over Delhi by making them aware of all Technical, Cultural, Management fests, workshops, Seminars organized by every college in Delhi.

Join Us Now

Program 35: Write a program to print the duplicate elements of an array.


<!DOCTYPE html>  
	<title>PHP Programs</title>
		$arr1 = array(10, 2, 3, 4, 18, 10, 8, 18, 3);   
		print("Duplicate elements in given array are : <br>");  
		for($i = 0; $i < count($arr1); $i++) 
			for($j = $i + 1; $j < count($arr1); $j++) 
				if($arr1[$i] == $arr1[$j])  
					print($arr1[$j] . "<br>");  

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.