3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-Type: text/html; charset=UTF-8'); function traffic($startlat, $startlon, $endlat, $endlon) { GLOBAL $traffic; $traffic=file_get_contents('https://www.waze.com/il-RoutingManager/routingRequest?from=x%3A'.$startlon.'+y%3A'.$startlat.'&to=x%3A'.$endlon.'+y%3A'.$endlat.'&at=0&returnJSON=true&timeout=60000&nPaths=1&clientVersion=4.0.0'); $traffic=json_decode($traffic,true); $tijd=0;$lengte=0; foreach($traffic['response']['results'] as $street) { $tijd = $tijd + $street['crossTime']; $lengte = $lengte + $street['length']; } $tijd = strftime("%M:%S",$tijd); $lengte = round($lengte / 1000,0); return array('tijd' => $tijd, 'lengte' => $lengte); } // $hw = traffic(50.892565,3.114135,50.877122,4.164326); // echo 'Home - Work = '.$hw['tijd'].' / '.$hw['lengte'].'km<br>'; // $wh = traffic(50.877122,4.164326,50.892565,3.114135); // echo 'Work - Home = '.$wh['tijd'].' / '.$wh['lengte'].'km<br>'; $hw = traffic(32.223122,34.993726,32.061679,34.793838); echo 'kokav - Work = '.$hw['tijd'].' / '.$hw['lengte'].'km<br>'; $hw = traffic(32.293122,34.993726,32.061679,34.793838); echo 'kokav2 - Work time MM:SS= '.$hw['tijd'].' / '.$hw['lengte'].'km<br>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4sK5o
function name:  (null)
number of ops:  32
compiled vars:  !0 = $hw
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-Type%3A+text%2Fhtml%3B+charset%3DUTF-8'
          2        DO_ICALL                                                 
   24     3        INIT_FCALL                                               'traffic'
          4        SEND_VAL                                                 32.2231
          5        SEND_VAL                                                 34.9937
          6        SEND_VAL                                                 32.0617
          7        SEND_VAL                                                 34.7938
          8        DO_FCALL                                      0  $2      
          9        ASSIGN                                                   !0, $2
   25    10        FETCH_DIM_R                                      ~4      !0, 'tijd'
         11        CONCAT                                           ~5      'kokav+-+Work+%3D+', ~4
         12        CONCAT                                           ~6      ~5, '+%2F+'
         13        FETCH_DIM_R                                      ~7      !0, 'lengte'
         14        CONCAT                                           ~8      ~6, ~7
         15        CONCAT                                           ~9      ~8, 'km%3Cbr%3E'
         16        ECHO                                                     ~9
   27    17        INIT_FCALL                                               'traffic'
         18        SEND_VAL                                                 32.2931
         19        SEND_VAL                                                 34.9937
         20        SEND_VAL                                                 32.0617
         21        SEND_VAL                                                 34.7938
         22        DO_FCALL                                      0  $10     
         23        ASSIGN                                                   !0, $10
   28    24        FETCH_DIM_R                                      ~12     !0, 'tijd'
         25        CONCAT                                           ~13     'kokav2+-+Work+time+MM%3ASS%3D+', ~12
         26        CONCAT                                           ~14     ~13, '+%2F+'
         27        FETCH_DIM_R                                      ~15     !0, 'lengte'
         28        CONCAT                                           ~16     ~14, ~15
         29        CONCAT                                           ~17     ~16, 'km%3Cbr%3E'
         30        ECHO                                                     ~17
         31      > RETURN                                                   1

Function traffic:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 35
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 35
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/4sK5o
function name:  traffic
number of ops:  51
compiled vars:  !0 = $startlat, !1 = $startlon, !2 = $endlat, !3 = $endlon, !4 = $traffic, !5 = $tijd, !6 = $lengte, !7 = $street
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    5     4        BIND_GLOBAL                                              !4, 'traffic'
    6     5        INIT_FCALL                                               'file_get_contents'
          6        CONCAT                                           ~8      'https%3A%2F%2Fwww.waze.com%2Fil-RoutingManager%2FroutingRequest%3Ffrom%3Dx%253A', !1
          7        CONCAT                                           ~9      ~8, '%2By%253A'
          8        CONCAT                                           ~10     ~9, !0
          9        CONCAT                                           ~11     ~10, '%26to%3Dx%253A'
         10        CONCAT                                           ~12     ~11, !3
         11        CONCAT                                           ~13     ~12, '%2By%253A'
         12        CONCAT                                           ~14     ~13, !2
         13        CONCAT                                           ~15     ~14, '%26at%3D0%26returnJSON%3Dtrue%26timeout%3D60000%26nPaths%3D1%26clientVersion%3D4.0.0'
         14        SEND_VAL                                                 ~15
         15        DO_ICALL                                         $16     
         16        ASSIGN                                                   !4, $16
    7    17        INIT_FCALL                                               'json_decode'
         18        SEND_VAR                                                 !4
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $18     
         21        ASSIGN                                                   !4, $18
    9    22        ASSIGN                                                   !5, 0
         23        ASSIGN                                                   !6, 0
   10    24        FETCH_DIM_R                                      ~22     !4, 'response'
         25        FETCH_DIM_R                                      ~23     ~22, 'results'
         26      > FE_RESET_R                                       $24     ~23, ->35
         27    > > FE_FETCH_R                                               $24, !7, ->35
   11    28    >   FETCH_DIM_R                                      ~25     !7, 'crossTime'
         29        ADD                                              ~26     !5, ~25
         30        ASSIGN                                                   !5, ~26
   12    31        FETCH_DIM_R                                      ~28     !7, 'length'
         32        ADD                                              ~29     !6, ~28
         33        ASSIGN                                                   !6, ~29
   10    34      > JMP                                                      ->27
         35    >   FE_FREE                                                  $24
   14    36        INIT_FCALL                                               'strftime'
         37        SEND_VAL                                                 '%25M%3A%25S'
         38        SEND_VAR                                                 !5
         39        DO_ICALL                                         $31     
         40        ASSIGN                                                   !5, $31
   15    41        INIT_FCALL                                               'round'
         42        DIV                                              ~33     !6, 1000
         43        SEND_VAL                                                 ~33
         44        SEND_VAL                                                 0
         45        DO_ICALL                                         $34     
         46        ASSIGN                                                   !6, $34
   16    47        INIT_ARRAY                                       ~36     !5, 'tijd'
         48        ADD_ARRAY_ELEMENT                                ~36     !6, 'lengte'
         49      > RETURN                                                   ~36
   17    50*     > RETURN                                                   null

End of function traffic

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.38 ms | 1406 KiB | 25 Q