3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '1 2 3 4 5 6 7 8 9 Apollo-1 10'; if (preg_match_all('/(?<!\S)[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?(?!\S)/', $str, $matches)) { print_r($matches[0]); }
Output for 7.1.25 - 7.1.31, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 )

preferences:
139.39 ms | 403 KiB | 174 Q