Jump to content

Removing everything but numbers in a string


TexasMd91

Recommended Posts

try something like this:

 

$new_string = ereg_replace('[^0-9]', '', $old_string);

 

writing that off the top of my head here, so it might be the incorrect param order or regex.  but, theoretically, that's what you're looking for (a regex that matches anything that isn't a digit).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.