3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $numbers = explode("\n", '(111) 222-3333 ((111) 222-3333 1112223333 111 222-3333 111-222-3333 (111)2223333 +11234567890 1-8002353551 123-456-7890 -Hello! +1 - 1234567890 '); foreach($numbers as $number) { print preg_replace('~.*(\d{3})[^\d]{0,7}(\d{3})[^\d]{0,7}(\d{4}).*~', '$1$2$3', $number). "\n"; }
based on PnpNN
Output for 5.6.0 - 7.3.0alpha1
1112223333 1112223333 1112223333 1112223333 1112223333 1112223333 1234567890 8002353551 1234567890 1234567890