I'm trying to get this recursive function to work. I echoed out $needle at the beginning, so I know it is incrementing correctly, and I know that is stopping at the correct increment. However, it is not returning the $needle.
function unique_name($needle, $haystack, $mod = "x")
{
if( !in_array($needle, $haystack) ) return $needle;
else unique_name($needle . $mod, $haystack, $mod);
}