<?php
function ip_clean(string $ip) : ?string
{
return implode(
'.',
array_map(
function ($el) {
return (int) $el;
},
explode('.', $ip)
)
);
}
echo ip_clean('195.194.213.096'), PHP_EOL;
- Output for 7.1.0, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.3 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- 195.194.213.96
- Output for 7.0.0 - 7.0.8
- Parse error: syntax error, unexpected '?' in /in/NcNg7 on line 3
Process exited with code 255. - Output for 5.5.0 - 5.5.37, 5.6.0 - 5.6.23
- Parse error: syntax error, unexpected ':', expecting '{' in /in/NcNg7 on line 3
Process exited with code 255.
preferences:
158.08 ms | 401 KiB | 206 Q