How to convert coordinates into latitude and longitude in php (laravel)?

My coordinates are in this format:

"3945N 02001E"

"4007N 02013E"

"4043N 01957E"

and I want to convert into latitudes and longitudes like that

"lat" => 51.23570538029149, "lng" => 4.429959780291502

"lat" => 51.23570538029149, "lng" => 4.429959780291502

"lat" => 51.23570538029149, "lng" => 4.429959780291502

2 answers