The geospatial extension has a function for this too:


<?php
$jeb 
= [ 'type' => 'Point''coordinates' => [ 45.74, -47.11 ] ];
$ksp = [ 'type' => 'Point''coordinates' => [ -74.57527, -0.1025 ] ];
var_dump((initial_bearing($jeb$ksp) + 360) % 360);
?>
Output