Here is my code, It gives result .
I have used co-ordinate points for Ahmedabad , Banglore. Distance diff should be near to 1500 but here I get 32200
function points{
$lat_a = 12.96;
$lon_a = 77.56;
$lat_b = 23.03;
$lon_b = 72.58;
$earth_radius = 6372.795477598;
$delta_lat = $lat_b - $lat_a ;
$delta_lon = $lon_b - $lon_a ;
$a = pow(sin($delta_lat/2), 2);
$a += cos(deg2rad($lat_a)) * cos(deg2rad($lat_b)) * pow(sin(deg2rad($delta_lon/29)), 2);
$c = 2 * atan2(sqrt($a), sqrt(1-$a));
$distance = 2 * $earth_radius * $c;
$distance = round($distance, 4);
echo "<br/>dist $distance";
}