oder Versuchs mal mit
$lat = floatval($lat);
floatval() und das Typecasting mittels (float) machen exakt dasselbe - wenn das eine nicht funktioniert wird das andere ebenfalls nicht funktionieren:
https://github.com/php/php-src/blob/642721b38a9c5ebf336c81027c0dafd6f9246bd6/ext/standard/type.c
(float) Zeile 105
floatval() Zeile 166
Beides führt nur convert_to_double() aus - und das konvertiert so ziemlich alles, auch Objekte:
https://github.com/php/php-src/blob/7713b8c2ac2d8fbacaf897ff0c0a202a7b7abf49/Zend/zend_operators.c
Zeile 429