So ... what gets passed to get_site_addr()? It looks like it's supposed to be an IP address string.
Got a whole bunch of errors first. After fixing a typo:
if($web['ipa'] == '.')
should be
if($web[$ipa] == '.'){
I get
echo get_site_addr('127.0.0.1');
Notice: Undefined offset: 3 in C:\test.php on line 36
and print_r($ip_2) yields
Array
(
[0] => 01111111
[1] => 00000000
[2] => 00000000
)
Which explains the error message and why there was nothing returned. What happened to the ".1", I wonder?
The whole parsing loop could be replaced by a [man]preg_match[/man] or a [man]sscanf[/man] call. Then again, from what I can make out the whole function could be rewritten as
function get_site_addr($ip){ return ip2long($ip);}