You could use preg_replace to swap out all non-numeric characters and the comma and period/full stop as follows:
$testString = '12.322,11T';
echo preg_replace('/[^0-9,.]+/', '', $testString);
The pattern can also be expressed as /[^\d,.]+/
More Related Contents:
- How to display RSS Feeds on a website, the other way? [closed]
- php execute a background process
- Website screenshots
- Cross-Origin Request Headers(CORS) with PHP headers
- Multiple returns from a function
- Convert Base64 string to an image file? [duplicate]
- How do I get the query builder to output its raw SQL query as a string?
- Remove excess whitespace from within a string
- How to query between two dates using Laravel and Eloquent?
- Using an array as needles in strpos
- Create programmatically a WooCommerce product variation with new attribute values
- JavaScript equivalent of PHP’s in_array()
- Is it possible to hide/encode/encrypt php source code and let others have the system?
- Multidimensional array iteration
- What is ?: in PHP 5.3? [duplicate]
- Using PHP and google Maps Api to work out distance between 2 post codes (UK)
- Laravel: connect to databases dynamically
- Print time in 15-minute increments between two times in the same day
- How to bind parameters to a raw DB query in Laravel that’s used on a model?
- PHP date() and strtotime() return wrong months on 31st
- How do I throttle my site’s API users?
- Get Text From Tag Using PHP
- Format text in Excel file via PHP
- Detecting Ajax in PHP and making sure request was from my own website
- Do I really need to do mysql_close()
- How to get the last element of an array without deleting it?
- Checking if ANY of an array’s elements are in another array
- laravel 4 custom named password column
- PHP rename array keys in multidimensional array
- mysqli_fetch_array returning only one result