3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ipString = 'ffff:heee:dddd:cccc:bbbb:aaaa:9999:8888'; $test = array(); preg_match_all("/(?U:[a-f0-9]+:?)+/", $ipString, $test); if(count($test) > 1 || count($test[0]) > 8){ echo "improper count\n"; echo 'false'; }else{ echo "proper count\n"; if(implode(':', $test[0]) !== $ipString){ echo "imploded matches doesn't match original string\n"; echo 'false'; } } var_dump($test); var_dump($ipString); echo implode(':', $test[0]); echo true; ?>

preferences:
34.82 ms | 402 KiB | 5 Q