PHP: How to get integer or decimal from a string?

Suppose, I have a string with text and number and I only want the number. I don’t want the characters and text of the string. Here is the way out:- In this example, you will get only integer. It will omit all characters and text from the string. $string = 'Nrs 89,994,874.0098'; echo preg_replace("/[^0-9]/", '', … Read more