> I don't THINK I need to worry about circular mappings... but I'm not
> sure how to check for it if I did...
> 
> Any suggestions? Thanks!

Would the following work? It avoids recursion entirely and also checks for
circular mappings. You can plug in your own code where the comments are to do
whatever is appropriate when a circular mapping is detected.

function GetMappedField($Field)
{
    $OriginalField = $Field;

    while (isset($FieldMap[$Field]) {
        $Field = $FieldMap[$Field];

        if ($Field === $OriginalField) {
            /*
             * circular mapping has been detected;
             * report an error or explode or whatever
             */
             break;
        }
    }

    return $Field;
}


Ben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to