Say $ip is 127.0.0.1
If I do
$ar=split(".",$ip);
I got a 9 empty array
$ar=split(".",$ip); I got the correct result namely 127, 0, 0, 1
But why should I escape the dot? I shouldn't right?
It is because [man]split/man (which is being deprecated, by the way) uses a regular expression technique where "." has a special meaning ("any character"). Instead, use [man]explode/man which will function as you initially intended. (If you need to split via a regular expression, [man]preg_split/man would be the better way to go now.)