3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sub = array( '+7 812-703-10-00', '8-812-346-60-01', '+7(495)785-98-42', '(499) 725 77 88', '8 (495) 663-61-00', '(812) 448-54-18', '8916-318-36-36', '540-69-05' ); foreach($sub as $s){ preg_match('/^(\+?\d+)?\s*(\(\d+\))?[\s-]*([\d-]*)$/', $s, $res); var_dump($res); }
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> string(16) "+7 812-703-10-00" [1]=> string(2) "+7" [2]=> string(0) "" [3]=> string(13) "812-703-10-00" } array(4) { [0]=> string(15) "8-812-346-60-01" [1]=> string(1) "8" [2]=> string(0) "" [3]=> string(13) "812-346-60-01" } array(4) { [0]=> string(16) "+7(495)785-98-42" [1]=> string(2) "+7" [2]=> string(5) "(495)" [3]=> string(9) "785-98-42" } array(0) { } array(4) { [0]=> string(17) "8 (495) 663-61-00" [1]=> string(1) "8" [2]=> string(5) "(495)" [3]=> string(9) "663-61-00" } array(4) { [0]=> string(15) "(812) 448-54-18" [1]=> string(0) "" [2]=> string(5) "(812)" [3]=> string(9) "448-54-18" } array(4) { [0]=> string(14) "8916-318-36-36" [1]=> string(4) "8916" [2]=> string(0) "" [3]=> string(9) "318-36-36" } array(4) { [0]=> string(9) "540-69-05" [1]=> string(3) "540" [2]=> string(0) "" [3]=> string(5) "69-05" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.58 ms | 403 KiB | 8 Q