3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $values = '222-333-4545'; if (strlen($values) > 0 && !preg_match('/^[1]{0,1}-[0-9]{3}-[0-9]{3}-[0-9]{3,4}$/', $values)) { $err_msg[4] = ('Phone number must be in format xxx-nnn-nnnn.'); echo $err_msg[4]; }
based on ZofN0
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
Phone number must be in format xxx-nnn-nnnn.