3v4l.org

run code in 300+ PHP versions simultaneously
<html> <head><title>Simple PHP Script to get the Latitude and Longitute using Google API - Blog.Theonlytutorials.com</title></head> <body> <h2>Simple PHP Script to get the Latitude and Longitude using Google API - Blog.Theonlytutorials.com</h2> <br /> <form action="" method="post"> Type Your Location : <input type="text" name="myaddress" /> (eg. Whitefield, Bangalore) </form> <br /> <?php //blog.theonlytutorials.com //author: agurchand if(isset($_POST['myaddress'])){ $myaddress = urlencode($_POST['myaddress']); //here is the google api url $url = "http://maps.googleapis.com/maps/api/geocode/json?address=$myaddress&sensor=false"; //get the content from the api using file_get_contents $getmap = file_get_contents($url); //the result is in json format. To decode it use json_decode $googlemap = json_decode($getmap); //get the latitute, longitude from the json result by doing a for loop foreach($googlemap->results as $res){ $address = $res->geometry; $latlng = $address->location; $formattedaddress = $res->formatted_address; ?> <br /> <!-- Print the Latitude and Longitude --> <?php echo "Latitude: ". $latlng->lat ."<br />". "Longitude:". $latlng->lng; ?> <h2>Dynamic Location on Google Map!</h2> <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=<?php echo $myaddress;?>&amp;ie=UTF8&amp;hq=&amp;hnear=<?php echo urlencode($formattedaddress);?>&amp;t=m&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe> <?php } } ?> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 49
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 48
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 48
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
Branch analysis from position: 49
filename:       /in/59XKm
function name:  (null)
number of ops:  51
compiled vars:  !0 = $myaddress, !1 = $url, !2 = $getmap, !3 = $googlemap, !4 = $res, !5 = $address, !6 = $latlng, !7 = $formattedaddress
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3Chtml%3E%0A%0A%3Chead%3E%3Ctitle%3ESimple+PHP+Script+to+get+the+Latitude+and+Longitute+using+Google+API+-+Blog.Theonlytutorials.com%3C%2Ftitle%3E%3C%2Fhead%3E%0A%0A%3Cbody%3E%0A%0A%3Ch2%3ESimple+PHP+Script+to+get+the+Latitude+and+Longitude+using+Google+API+-+Blog.Theonlytutorials.com%3C%2Fh2%3E%0A%0A%3Cbr+%2F%3E%0A%0A%3Cform+action%3D%22%22+method%3D%22post%22%3E%0A%0AType+Your+Location+%3A+%3Cinput+type%3D%22text%22+name%3D%22myaddress%22+%2F%3E+%28eg.+Whitefield%2C+Bangalore%29%0A%0A%3C%2Fform%3E%0A%0A%3Cbr+%2F%3E%0A%0A'
   27     1        FETCH_IS                                         ~8      '_POST'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~8, 'myaddress'
          3      > JMPZ                                                     ~9, ->49
   29     4    >   INIT_FCALL                                               'urlencode'
          5        FETCH_R                      global              ~10     '_POST'
          6        FETCH_DIM_R                                      ~11     ~10, 'myaddress'
          7        SEND_VAL                                                 ~11
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !0, $12
   33    10        ROPE_INIT                                     3  ~15     'http%3A%2F%2Fmaps.googleapis.com%2Fmaps%2Fapi%2Fgeocode%2Fjson%3Faddress%3D'
         11        ROPE_ADD                                      1  ~15     ~15, !0
         12        ROPE_END                                      2  ~14     ~15, '%26sensor%3Dfalse'
         13        ASSIGN                                                   !1, ~14
   37    14        INIT_FCALL                                               'file_get_contents'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $18     
         17        ASSIGN                                                   !2, $18
   41    18        INIT_FCALL                                               'json_decode'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $20     
         21        ASSIGN                                                   !3, $20
   45    22        FETCH_OBJ_R                                      ~22     !3, 'results'
         23      > FE_RESET_R                                       $23     ~22, ->48
         24    > > FE_FETCH_R                                               $23, !4, ->48
   47    25    >   FETCH_OBJ_R                                      ~24     !4, 'geometry'
         26        ASSIGN                                                   !5, ~24
   49    27        FETCH_OBJ_R                                      ~26     !5, 'location'
         28        ASSIGN                                                   !6, ~26
   51    29        FETCH_OBJ_R                                      ~28     !4, 'formatted_address'
         30        ASSIGN                                                   !7, ~28
   56    31        ECHO                                                     '%0A%3Cbr+%2F%3E%0A%0A%3C%21--+Print+the+Latitude+and+Longitude+--%3E%0A%0A'
   61    32        FETCH_OBJ_R                                      ~30     !6, 'lat'
         33        CONCAT                                           ~31     'Latitude%3A+', ~30
         34        CONCAT                                           ~32     ~31, '%3Cbr+%2F%3E'
         35        CONCAT                                           ~33     ~32, 'Longitude%3A'
         36        FETCH_OBJ_R                                      ~34     !6, 'lng'
         37        CONCAT                                           ~35     ~33, ~34
         38        ECHO                                                     ~35
   62    39        ECHO                                                     '%0A%3Ch2%3EDynamic+Location+on+Google+Map%21%3C%2Fh2%3E%0A%0A%3Ciframe+width%3D%22425%22+height%3D%22350%22+frameborder%3D%220%22+scrolling%3D%22no%22+marginheight%3D%220%22+marginwidth%3D%220%22+src%3D%22https%3A%2F%2Fmaps.google.com%2Fmaps%3Ff%3Dq%26amp%3Bsource%3Ds_q%26amp%3Bhl%3Den%26amp%3Bgeocode%3D%26amp%3Bq%3D'
   65    40        ECHO                                                     !0
         41        ECHO                                                     '%26amp%3Bie%3DUTF8%26amp%3Bhq%3D%26amp%3Bhnear%3D'
         42        INIT_FCALL                                               'urlencode'
         43        SEND_VAR                                                 !7
         44        DO_ICALL                                         $36     
         45        ECHO                                                     $36
         46        ECHO                                                     '%26amp%3Bt%3Dm%26amp%3Bz%3D14%26amp%3Biwloc%3DA%26amp%3Boutput%3Dembed%22%3E%3C%2Fiframe%3E%0A%0A'
   45    47      > JMP                                                      ->24
         48    >   FE_FREE                                                  $23
   74    49    >   ECHO                                                     '%0A%3C%2Fbody%3E%0A%0A%3C%2Fhtml%3E'
   77    50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.34 ms | 1400 KiB | 19 Q