iNaD ist right, the filter_var() version is the best one - ip2long() is really not that failsave. Just try to put in some strange things and see for yourself. I did a performace-check and filter_var is pretty much faster than the common regex versions.