3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $ip = '192.168.0.1'; $octets = explode('.', $ip); foreach($octets as $key => $octet) { $v = 255 - (int)$octet; $v + 255 == 255 ? $valid = true : $valid = false; if ($valid) echo 'valid'; else echo 'invalid'; } var_dump($octets);
based on oGEnp
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
invalidinvalidinvalidinvalidarray(4) { [0]=> string(3) "192" [1]=> string(3) "168" [2]=> string(1) "0" [3]=> string(1) "1" }
Output for hhvm-3.10.0

Process exited with code 153.