You can use below:
$array = []; preg_match_all('/-?\d+(?:\.\d+)?+/', $string, $array);
Where $ string is the entered string, and $ array is where each number (not a number!, Including negative values!) Is loaded and available for various additional operations.
Miroslav gorchev
source share