Issue
I have a phone number stored in $phone
, it looks like this: (555) 555-5555
. I want it to look like this: 5555555555
. How do I take the string and strip it of hyphens, spaces, and parenthesis?
Solution
With a regexp. Specifically, use the preg_replace
function:
$phone = preg_replace('/\D+/', '', $phone);
Answered By - outis
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.