Be aware the last tofloat($num).
In theory it is very useful to have a function "separator-agnostic" (I think "locale based" solutions are useless if you have to parse a user file that can have a locale different to the server).
But this can lead to misinterpretations; in short: "123,456" is "123.456" (so comma used as decimal separator) or "123456" (comma used as thousand separator).
In any case, if you really want to use it, please don't forget that this function doesn't manage negative numbers.