3v4l.org

run code in 300+ PHP versions simultaneously
<?php function normalize_phone($phone) { preg_match("/((?:\\d+[\\s\\-\\(\\)+]+){5,})/", $phone, $matches); $normalized_phone = preg_replace("/[^0-9]+/", "", $matches[1]); if (substr($normalized_phone, 0, 1) === "7") $normalized_phone = "8" . substr($normalized_phone, 1); elseif (substr($normalized_phone, 0, 1) === "9") $normalized_phone = "8" . $normalized_phone; return $normalized_phone; } echo normalize_phone("10 тел +7 (916) 297-67-97 Александр Мартынов 10");
Output for git.master, git.master_jit, rfc.property-hooks
89162976797

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:
35.2 ms | 401 KiB | 8 Q