3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $test = array( '+380671072122','+3 80671072122','+3 8 067 107 21 22','+38(067)1072122','+38 (067) 107 21 22','+3 8067 107-21-22','067 107 21 22','067-107-21-22' ); foreach($test as $t){ $number = preg_replace('/\D+/', '', $t); print_r($number.PHP_EOL); }
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
380671072122 380671072122 380671072122 380671072122 380671072122 380671072122 0671072122 0671072122
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Iukq2 on line 9 380671072122PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Iukq2 on line 9 380671072122PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Iukq2 on line 9 380671072122PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Iukq2 on line 9 380671072122PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Iukq2 on line 9 380671072122PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Iukq2 on line 9 380671072122PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Iukq2 on line 9 0671072122PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Iukq2 on line 9 0671072122PHP_EOL