<?php
function maskIp($value) {
$j = 0;
for ($i = $len - 1; $j < 4 && $i > -1; --$i) {
++$j;
$value{$i} = '*';
}
}
return $value;
}
echo maskIp('127.0.0.100'), PHP_EOL;
echo maskIp('127.0.0.10'), PHP_EOL;
echo maskIp('127.0.0.1'), PHP_EOL;
echo maskIp('127.0.255.100'), PHP_EOL;
echo maskIp('127.0.25.100'), PHP_EOL;
PD9waHAKCmZ1bmN0aW9uIG1hc2tJcCgkdmFsdWUpIHsKICAgICRsZW4gPSBzdHJsZW4oJHZhbHVlKTsKICAgICRqID0gMDsKCiAgICBmb3IgKCRpID0gJGxlbiAtIDE7ICRqIDwgNCAmJiAkaSA+IC0xOyAtLSRpKSB7CiAgICAgICAgaWYgKGN0eXBlX2RpZ2l0KCR2YWx1ZXskaX0pKSB7CiAgICAgICAgICAgICsrJGo7CiAgICAgICAgICAgICR2YWx1ZXskaX0gPSAnKic7CiAgICAgICAgfQogICAgfQoKICAgIHJldHVybiAkdmFsdWU7Cn0KCmVjaG8gbWFza0lwKCcxMjcuMC4wLjEwMCcpLCBQSFBfRU9MOwplY2hvIG1hc2tJcCgnMTI3LjAuMC4xMCcpLCBQSFBfRU9MOwplY2hvIG1hc2tJcCgnMTI3LjAuMC4xJyksIFBIUF9FT0w7CmVjaG8gbWFza0lwKCcxMjcuMC4yNTUuMTAwJyksIFBIUF9FT0w7CmVjaG8gbWFza0lwKCcxMjcuMC4yNS4xMDAnKSwgUEhQX0VPTDs=