SyntaxFix
Write A Post
Hire A Developer
Questions
I think you're saying you want to remove all non-numeric characters. If so, \D means "anything that isn't a digit":
\D
preg_replace('/\D/', '', $c)