<?php
// PHP implementation of the approach
// Function that returns true if
// the array is mirror-inverse
function isMirrorInverse($arr)
{
for ($i = 0; $i < sizeof($arr); $i++)
{
// If condition fails for any element
if ($arr[$arr[$i]] != $i)
return false;
}
// Given array is mirror-inverse
return true;
}
// Driver code
$arr = array(1, 2, 3, 0);
if (isMirrorInverse($arr))
echo("Yes");
else
echo("No");
// These code is contributed by Code_Mech.
?>