PHP code to remove everything but numbers
Try this:
preg_replace('/[^0-9]/', '', '604-619-5135');
preg_replace uses PCREs which generally start and end with a /
.
This is for future developers, you can also try this. Simple too
echo preg_replace('/\D/', '', '604-619-5135');
You would need to enclose the pattern in a delimiter - typically a slash (/) is used. Try this:
echo preg_replace("/[^0-9]/","",'604-619-5135');