preg_replace
I don't have access to a php environment just now to test this, so bear in mind that this may not be exactly right, but should be within a few tweaks of it.
let's say your potentially-punctuation-ridden phone number is in a variable called $phoneNumber.
You could do (I think)
$phoneNumber = preg_replace("\D","",$phoneNumber);
Note that the second parameter is an empty string ie double-quote dou0pbele-quote with nothing in between.
This uses the power of regular expressions to replace all non-numeric characters "\D", with nothing "".
It doesn't do anything to enforce the length of the string, but if you need to, you can use strlen() for that.