Jump to content

Expression to return numbers only


playaz

Recommended Posts

Hi guys,

 

I am a total newbie at regex - I require an expression that will remove all letters from a string eg..

Below is an example of original string, and the result I would need in the $newString variable - what expression would be required to do this?

 

$string = '472PP';

$newString = '472';

 

Thanks again!

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/158253-expression-to-return-numbers-only/
Share on other sites

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.