<?php
function getRange($ip) {
$split = explode('.',$ip);
$final = array();
foreach ($split as $block) {
$pos = strpos($block, '*');
if ($pos !== false) {
$num = substr($block, 0, $pos)
$l = strlen($block);
$min = (int) str_pad($num,3,'0');
$max = (int) min(255,str_pad($num,3,'9'));
$minip = $final;
$minip[] = $min;
$minip = array_pad($minip, 4, 0);
$maxip = $final;
$maxip[] = $max;
$maxip = array_pad($maxip, 4, 255);
return array(implode('.',$minip),implode('.',$maxip));
}
$final[] = $block;
}
return array(implode('.',$final),implode('.',$final)); // No range found.
}
print_R(getRange("255.55.0.1"));
- Output for 5.4.0 - 5.4.11
- Parse error: syntax error, unexpected '$l' (T_VARIABLE) in 3U6El on line 9
Process exited with code 255. - Output for 5.3.0 - 5.3.21
- Parse error: syntax error, unexpected T_VARIABLE in 3U6El on line 9
Process exited with code 255.
preferences:
173.57 ms | 1395 KiB | 41 Q