And the reason the LEN check is necessary is because....As Mart just said...If you have blank elements in the $gateway array, and then do a split on it, it will only have 1 element in $data, so when you try to use $data[1] it fails.