Mehedi Hasan Siam
Mehedi Hasan Siam

Reputation: 1272

How to use a variable in google maps api

I have a google maps api, from which I can convert the area name from latitude and longitude. Code given bellow :

<?php
$url="https://maps.google.com/maps/api/geocode/json?latlng=23.756879299999998,90.3801968&key=key";

Now I want to make this $url dynamically. Here I have latlng= 23.756879299999998,90.3801968 I want to make it like this latlng = $lat,$long

How I can make this

Upvotes: 0

Views: 122

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

you could use a simple string concat eg:

<?php
$lat= "23.756879299999998";
$lng = "90.3801968";

$url="https://maps.google.com/maps/api/geocode/json?latlng=".$lat.",".$lng."&key=key";

Upvotes: 1

Related Questions