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?
With a regexp. Specifically, use the preg_replace function:
$phone = preg_replace('/\D+/', '', $phone);
preg_replace("/[^0-9]/", "", $phone);
Post Your Answers
What is critical region in Operation System?
who is Best AWS Training in Noida
Who is the Best Packers And Movers in Mumbai that Get Free Quotes & Compare and Save
Who is the Best Packers and Movers in Kota
Packers And Movers Hyderabad Get Free Quotes Compare and Save
How to Validate Password Strength in PHP
Who is the Best Packers and Movers in Bareilly ?
Which is top online agricultural marketplace portal in India?
Who is top and best packers and Movers services provider in pune and local pune area