I have a sting like "03335240141" i want display it like 0333-524-0141 is there any string function that can do this for me? thank you dizyn
You can do it with simple regex code. <?php $number = "03335240141"; $pattern = "/([0-9]{4})([0-9]{3})([0-9]{4})/"; preg_match($pattern, $number, $matches); echo $matches[1]. "-" .$matches[2]. "-" .$matches[3]; ?> PHP: