3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "<h1>Hello, PHP!</h1>"; $file = fopen("input.txt","r"); $list = new SplDoublyLinkedList(); //$list = new LinkList(); while(! feof($file)) { //print_r(fgetcsv($file)); $list->push(fgets($file)); //print_r(fgets($file)); } fclose($file); $list->rewind(); $currCityP = str_getcsv($list->current()); $string=implode(",",$currCityP); //echo "Init CurrCityP".$string."\r\n<br>"; $nextCityP = str_getcsv($list->current()); $string=implode(",",$nextCityP); //echo "Init nextCityP".$string."\r\n<br>"; //echo "Total num of cities is: ".$list->count()."\r\n<br>"; for ($x=1; $x<=$list->count(); $x++) { $currCityP = $nextCityP; $y=1; $min=10000; for ($list->rewind(); $list->valid(); $list->next()) { $tmpCityP = str_getcsv($list->current()); if ($y == $x+1) { $nextCityP = $tmpCityP; //echo "x & y are: ".$x.", ".$y."\r\n<br>"; } $y++; $dist = sqrt(pow(($tmpCityP[0]-$currCityP[0]),2)+pow(($tmpCityP[1]-$currCityP[1]),2)); if ($min > $dist && $dist != 0) { $min = $dist; } //echo "Distane".$dist."\r\n"; //echo "next\r\n"; } $string=implode(",",$currCityP); //echo "CurrCityP is: ".$string."\r\n<br>"; $string=implode(",",$nextCityP); //echo "NextCityP is: ".$string."\r\n<br>"; echo $min."\r\n<br>"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 110
Branch analysis from position: 110
2 jumps found. (Code = 44) Position 1 = 114, Position 2 = 50
Branch analysis from position: 114
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 94
Branch analysis from position: 94
2 jumps found. (Code = 44) Position 1 = 97, Position 2 = 56
Branch analysis from position: 97
2 jumps found. (Code = 44) Position 1 = 114, Position 2 = 50
Branch analysis from position: 114
Branch analysis from position: 50
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 66
Branch analysis from position: 65
2 jumps found. (Code = 46) Position 1 = 88, Position 2 = 90
Branch analysis from position: 88
2 jumps found. (Code = 43) Position 1 = 91, Position 2 = 92
Branch analysis from position: 91
2 jumps found. (Code = 44) Position 1 = 97, Position 2 = 56
Branch analysis from position: 97
Branch analysis from position: 56
Branch analysis from position: 92
Branch analysis from position: 90
Branch analysis from position: 66
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/nFcAa
function name:  (null)
number of ops:  115
compiled vars:  !0 = $file, !1 = $list, !2 = $currCityP, !3 = $string, !4 = $nextCityP, !5 = $x, !6 = $y, !7 = $min, !8 = $tmpCityP, !9 = $dist
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                     '%3Ch1%3EHello%2C+PHP%21%3C%2Fh1%3E'
    3     1        INIT_FCALL                                               'fopen'
          2        SEND_VAL                                                 'input.txt'
          3        SEND_VAL                                                 'r'
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !0, $10
    4     6        NEW                                              $12     'SplDoublyLinkedList'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $12
    6     9      > JMP                                                      ->16
    9    10    >   INIT_METHOD_CALL                                         !1, 'push'
         11        INIT_FCALL                                               'fgets'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $15     
         14        SEND_VAR_NO_REF_EX                                       $15
         15        DO_FCALL                                      0          
    6    16    >   INIT_FCALL                                               'feof'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $17     
         19        BOOL_NOT                                         ~18     $17
         20      > JMPNZ                                                    ~18, ->10
   12    21    >   INIT_FCALL                                               'fclose'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
   13    24        INIT_METHOD_CALL                                         !1, 'rewind'
         25        DO_FCALL                                      0          
   14    26        INIT_FCALL                                               'str_getcsv'
         27        INIT_METHOD_CALL                                         !1, 'current'
         28        DO_FCALL                                      0  $21     
         29        SEND_VAR                                                 $21
         30        DO_ICALL                                         $22     
         31        ASSIGN                                                   !2, $22
   15    32        INIT_FCALL                                               'implode'
         33        SEND_VAL                                                 '%2C'
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                         $24     
         36        ASSIGN                                                   !3, $24
   17    37        INIT_FCALL                                               'str_getcsv'
         38        INIT_METHOD_CALL                                         !1, 'current'
         39        DO_FCALL                                      0  $26     
         40        SEND_VAR                                                 $26
         41        DO_ICALL                                         $27     
         42        ASSIGN                                                   !4, $27
   18    43        INIT_FCALL                                               'implode'
         44        SEND_VAL                                                 '%2C'
         45        SEND_VAR                                                 !4
         46        DO_ICALL                                         $29     
         47        ASSIGN                                                   !3, $29
   23    48        ASSIGN                                                   !5, 1
         49      > JMP                                                      ->110
   24    50    >   ASSIGN                                                   !2, !4
   25    51        ASSIGN                                                   !6, 1
   26    52        ASSIGN                                                   !7, 10000
   27    53        INIT_METHOD_CALL                                         !1, 'rewind'
         54        DO_FCALL                                      0          
         55      > JMP                                                      ->94
   28    56    >   INIT_FCALL                                               'str_getcsv'
         57        INIT_METHOD_CALL                                         !1, 'current'
         58        DO_FCALL                                      0  $36     
         59        SEND_VAR                                                 $36
         60        DO_ICALL                                         $37     
         61        ASSIGN                                                   !8, $37
   29    62        ADD                                              ~39     !5, 1
         63        IS_EQUAL                                                 !6, ~39
         64      > JMPZ                                                     ~40, ->66
   30    65    >   ASSIGN                                                   !4, !8
   33    66    >   PRE_INC                                                  !6
   34    67        INIT_FCALL                                               'sqrt'
         68        INIT_FCALL                                               'pow'
         69        FETCH_DIM_R                                      ~43     !8, 0
         70        FETCH_DIM_R                                      ~44     !2, 0
         71        SUB                                              ~45     ~43, ~44
         72        SEND_VAL                                                 ~45
         73        SEND_VAL                                                 2
         74        DO_ICALL                                         $46     
         75        INIT_FCALL                                               'pow'
         76        FETCH_DIM_R                                      ~47     !8, 1
         77        FETCH_DIM_R                                      ~48     !2, 1
         78        SUB                                              ~49     ~47, ~48
         79        SEND_VAL                                                 ~49
         80        SEND_VAL                                                 2
         81        DO_ICALL                                         $50     
         82        ADD                                              ~51     $46, $50
         83        SEND_VAL                                                 ~51
         84        DO_ICALL                                         $52     
         85        ASSIGN                                                   !9, $52
   35    86        IS_SMALLER                                       ~54     !9, !7
         87      > JMPZ_EX                                          ~54     ~54, ->90
         88    >   IS_NOT_EQUAL                                     ~55     !9, 0
         89        BOOL                                             ~54     ~55
         90    > > JMPZ                                                     ~54, ->92
   36    91    >   ASSIGN                                                   !7, !9
   27    92    >   INIT_METHOD_CALL                                         !1, 'next'
         93        DO_FCALL                                      0          
         94    >   INIT_METHOD_CALL                                         !1, 'valid'
         95        DO_FCALL                                      0  $58     
         96      > JMPNZ                                                    $58, ->56
   41    97    >   INIT_FCALL                                               'implode'
         98        SEND_VAL                                                 '%2C'
         99        SEND_VAR                                                 !2
        100        DO_ICALL                                         $59     
        101        ASSIGN                                                   !3, $59
   43   102        INIT_FCALL                                               'implode'
        103        SEND_VAL                                                 '%2C'
        104        SEND_VAR                                                 !4
        105        DO_ICALL                                         $61     
        106        ASSIGN                                                   !3, $61
   45   107        CONCAT                                           ~63     !7, '%0D%0A%3Cbr%3E'
        108        ECHO                                                     ~63
   23   109        PRE_INC                                                  !5
        110    >   INIT_METHOD_CALL                                         !1, 'count'
        111        DO_FCALL                                      0  $65     
        112        IS_SMALLER_OR_EQUAL                                      !5, $65
        113      > JMPNZ                                                    ~66, ->50
   46   114    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.51 ms | 1396 KiB | 29 Q