If you want to display direction on google map to draw a straight line in php code.Then you need to just copy and paste below code .Before copy this you need to be include google map library and make it constructor like below :
$google_maps = new Googlemaps();
$polyline = array();
$polyline['points'] = array($ad->lat_decimal.','.$ad->long_decimal,$get_lat_long_array[0].','.$get_lat_long_array[1]);
$google_maps->add_polyline($polyline);
Description: In this we pass an array with the source and destination latitude and longitude with seprate it by ','.
Example array:
$polyline['points'] =array(source_latitude,source_longitude,destination_latitude,destination_longitude)
$google_maps = new Googlemaps();
$polyline = array();
$polyline['points'] = array($ad->lat_decimal.','.$ad->long_decimal,$get_lat_long_array[0].','.$get_lat_long_array[1]);
$google_maps->add_polyline($polyline);
Description: In this we pass an array with the source and destination latitude and longitude with seprate it by ','.
Example array:
$polyline['points'] =array(source_latitude,source_longitude,destination_latitude,destination_longitude)