3v4l.org

run code in 300+ PHP versions simultaneously
<?php // PHP script to parse routes of MalindoAir // Written by Milan Zoric // o0milanzoric0o@gmail.com // oct 2015 parseRoutesMalindoAir(); function parseRoutesMalindoAir() { /* URL to download data form */ $url = 'https://search.malindoair.com/Customers/91/scripts/Route.js'; $airlineCode = 'OD'; $fileSource = get_url_contents($url); $illegalCodes = array('AMD'); // Reports error if failed to download if ($fileSource === false) { return reportError($airlineCode, $url); } $pos = strpos($fileSource, 'var hdnArrCities1 =['); $fares = substr($fileSource, $pos + strlen('var hdnArrCities1 =[')); //echo $fares; if(preg_match_all('/\"DepCode\":\"(?<dep>[A-Z]{3})\",\"ArrCode\":\"(?<arr>[A-Z]{3})\"/', $fares,$output_array)===0) { return reportError($airlineCode, $url); } $numFares = count($output_array["dep"]); for ($i = 0; $i < $numFares; $i++) { if (in_array($output_array["dep"][$i], $illegalCodes) or in_array($output_array["arr"][$i], $illegalCodes)) continue; $routes[] = array('org' => $output_array["dep"][$i], 'dst' => $output_array["arr"][$i]); } return updateRoutesCheck($airlineCode, $routes, $url); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BKggF
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL_BY_NAME                                       'parseRoutesMalindoAir'
          1        DO_FCALL                                      0          
   45     2      > RETURN                                                   1

Function parseroutesmalindoair:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 37
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 42
Branch analysis from position: 69
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
2 jumps found. (Code = 47) Position 1 = 49, Position 2 = 56
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 58
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 42
Branch analysis from position: 69
Branch analysis from position: 42
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 42
Branch analysis from position: 69
Branch analysis from position: 42
Branch analysis from position: 56
filename:       /in/BKggF
function name:  parseRoutesMalindoAir
number of ops:  76
compiled vars:  !0 = $url, !1 = $airlineCode, !2 = $fileSource, !3 = $illegalCodes, !4 = $pos, !5 = $fares, !6 = $output_array, !7 = $numFares, !8 = $i, !9 = $routes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, 'https%3A%2F%2Fsearch.malindoair.com%2FCustomers%2F91%2Fscripts%2FRoute.js'
   14     1        ASSIGN                                                   !1, 'OD'
   16     2        INIT_FCALL_BY_NAME                                       'get_url_contents'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $12     
          5        ASSIGN                                                   !2, $12
   17     6        ASSIGN                                                   !3, <array>
   20     7        TYPE_CHECK                                    4          !2
          8      > JMPZ                                                     ~15, ->14
   22     9    >   INIT_FCALL_BY_NAME                                       'reportError'
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $16     
         13      > RETURN                                                   $16
   25    14    >   INIT_FCALL                                               'strpos'
         15        SEND_VAR                                                 !2
         16        SEND_VAL                                                 'var+hdnArrCities1+%3D%5B'
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !4, $17
   26    19        INIT_FCALL                                               'substr'
         20        SEND_VAR                                                 !2
         21        ADD                                              ~19     !4, 20
         22        SEND_VAL                                                 ~19
         23        DO_ICALL                                         $20     
         24        ASSIGN                                                   !5, $20
   29    25        INIT_FCALL                                               'preg_match_all'
         26        SEND_VAL                                                 '%2F%5C%22DepCode%5C%22%3A%5C%22%28%3F%3Cdep%3E%5BA-Z%5D%7B3%7D%29%5C%22%2C%5C%22ArrCode%5C%22%3A%5C%22%28%3F%3Carr%3E%5BA-Z%5D%7B3%7D%29%5C%22%2F'
         27        SEND_VAR                                                 !5
         28        SEND_REF                                                 !6
         29        DO_ICALL                                         $22     
         30        IS_IDENTICAL                                             $22, 0
         31      > JMPZ                                                     ~23, ->37
   31    32    >   INIT_FCALL_BY_NAME                                       'reportError'
         33        SEND_VAR_EX                                              !1
         34        SEND_VAR_EX                                              !0
         35        DO_FCALL                                      0  $24     
         36      > RETURN                                                   $24
   34    37    >   FETCH_DIM_R                                      ~25     !6, 'dep'
         38        COUNT                                            ~26     ~25
         39        ASSIGN                                                   !7, ~26
   36    40        ASSIGN                                                   !8, 0
         41      > JMP                                                      ->67
   38    42    >   INIT_FCALL                                               'in_array'
         43        FETCH_DIM_R                                      ~29     !6, 'dep'
         44        FETCH_DIM_R                                      ~30     ~29, !8
         45        SEND_VAL                                                 ~30
         46        SEND_VAR                                                 !3
         47        DO_ICALL                                         $31     
         48      > JMPNZ_EX                                         ~32     $31, ->56
         49    >   INIT_FCALL                                               'in_array'
         50        FETCH_DIM_R                                      ~33     !6, 'arr'
         51        FETCH_DIM_R                                      ~34     ~33, !8
         52        SEND_VAL                                                 ~34
         53        SEND_VAR                                                 !3
         54        DO_ICALL                                         $35     
         55        BOOL                                             ~32     $35
         56    > > JMPZ                                                     ~32, ->58
         57    > > JMP                                                      ->66
   39    58    >   FETCH_DIM_R                                      ~37     !6, 'dep'
         59        FETCH_DIM_R                                      ~38     ~37, !8
         60        INIT_ARRAY                                       ~39     ~38, 'org'
         61        FETCH_DIM_R                                      ~40     !6, 'arr'
         62        FETCH_DIM_R                                      ~41     ~40, !8
         63        ADD_ARRAY_ELEMENT                                ~39     ~41, 'dst'
         64        ASSIGN_DIM                                               !9
         65        OP_DATA                                                  ~39
   36    66    >   PRE_INC                                                  !8
         67    >   IS_SMALLER                                               !8, !7
         68      > JMPNZ                                                    ~43, ->42
   43    69    >   INIT_FCALL_BY_NAME                                       'updateRoutesCheck'
         70        SEND_VAR_EX                                              !1
         71        SEND_VAR_EX                                              !9
         72        SEND_VAR_EX                                              !0
         73        DO_FCALL                                      0  $44     
         74      > RETURN                                                   $44
   44    75*     > RETURN                                                   null

End of function parseroutesmalindoair

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.27 ms | 1404 KiB | 21 Q