3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function ReformatPhoneNumber($n){ if(!preg_match('/\\d+?\\-?\\d+?\\s?\\d+/',$n))throw new Exception('Invalid phone number'); $n=str_replace(array('-',' '), '', $n); if(!in_array(strlen($n), array(7,12)))throw new Exception('Invalid phone number'); return $n; } echo ReformatPhoneNumber('2352-23593665');
Output for 5.2.17 - 5.6.21, hhvm-3.12.0, 7.0.0 - 7.1.0RC5
235223593665
Output for hhvm-3.10.0

Process exited with code 153.