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); }
Output for 4.3.0 - 7.1.0
3806710721223 806710721223 8 067 107 21 2238(067)107212238 (067) 107 21 223 8067 107-21-22067 107 21 22067-107-21-22