{
}
Online Python Compiler
Online R Compiler
Online SQL Editor
Online HTML/CSS Editor
Online Java Compiler
Online C Compiler
Online C++ Compiler
Online C# Compiler
Online JavaScript Compiler
Online GoLang Compiler
Online PHP Compiler
Online Swift Compiler
Online Rust Compiler
Generating Link
Generating Link
Share your code
Share code
Copy Link
Copied to clipboard
or share using
PHP Online Compiler
Learn Python App
Learn Python
main.php
Output
main.php
Share
Run
Run
<?php $mobile1 = '0101234567'; echo preg_replace('/(0(?:2|[0-9]{2}))([0-9]+)([0-9]{4}$)/', '\\1-\\2-\\3', $mobile1); echo "\n"; $mobile2 = '01012345678'; echo preg_replace('/(0(?:2|[0-9]{2}))([0-9]+)([0-9]{4}$)/', '\\1-\\2-\\3', $mobile2);
Output
Clear