I'm using code to get distance between two points, it works fine but the problem is the code returns data with KM characters(e.g 56.0 km), so I want to use the pure number to get it in Mile or to use it for comparing with other values
public function getdistance(Request $request)
{
$currentaddress =$request->currentadd;
$from = '4429 North Broadway, Chicago, IL, United States';
$remFrom = str_replace(',', '', $from); //Remove Commas
$from = urlencode($remFrom);
$to = $currentaddress;
$remTo = str_replace(',', '', $to); //Remove Commas
$to = urlencode($remTo);
$data = file_get_contents("http://maps.googleapis.com/maps/api/distancematrix/json?origins=$from&destinations=$to&language=en-EN&sensor=false");
$data = json_decode($data,true);
$distance = $data['rows'][0]['elements'][0]['distance']['text'];
return response()->json([$distance]);
}