I'm cleaning up some inherited code in our data import module. For a
variety of reasons we have to support old standards of the import
format. Since some of those old versions were created we have since
renamed some fields in our data structure. So right now I've a hard
map for some field names...

function GetMappedField($Field)
   $FieldMap["A"] = "B";
   $FieldMap["C"] = "D";

   return isset($FieldMap[$Field])?$FieldMap[$Field]:$Field);

But I've just spent a while tracking down a bug where someone mapped A
to B and then someone else mapped B to C.

I'm thinking of changing the return to...

   return isset($FieldMap[$Field])?GetMappedField($FieldMap[$Field]):$Field);

...but I'm worried about the recursion. (Which isn't a strength of mine)

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!


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

Reply via email to