I use this code to browse the arrays and if they match the code prints an alternative image.
The code works indeed it prints an alternative image when the two arrays match but the problem is that it prints every tooth 4 times..
How can I fix this problem?

And it is ok because the first array is the one that I defined while the second array ($array_denti_new) is the array that I fill with elements took from the database. This is the array ($array_p1n) I created and it matches with the function var_export:

$array_p1n = array(18,17,16,15,14,13,12,11);

With my code I would like to print the $array_p1n and while doing this I would like to check if the elements inside the second array ($array_denti_new) match with the elements of first array. If so, print an alternative image