3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $values = '1-222-333-4545'; if (strlen($values) > 0 && !preg_match('/^[0-9]{3}-[0-9]{3,4}-[0-9]{3,4}$/', $values)) { $err_msg[4] = ('Phone number must be in format xxx-nnnn-nnnn.'); echo $err_msg[4]; }
based on JJ5ma
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-nnnn-nnnn.