I would like to convert a string into floating numbers. For example
152.15 x 12.34 x 11mm
into
152.15, 12.34 and 11
$str = "152.15 x 12.34 x 11mm"; $str = str_replace("mm", "", $str); $str = explode("x", $str); print_r($str); // Array ( [0] => 152.15 [1] => 12.34 [2] => 11 )
Tested it and it works on all strings above.