Optimized code for reverse address php app (reviewed by Udit).