array sorting function in php

How to check ip address in php