3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array['route'] = 'LINESTRING(-25.3233034167988 -57.640113830566406,-25.3229348965009 -57.64023184776306,-25.322653656571582 -57.63954520225525,-25.323410093517822 -57.63928771018982,-25.3229058027454 -57.6378607749939,-25.322973688164012 -57.63678789138794,-25.323371301994506 -57.63360142707825,-25.322003892857673 -57.633676528930664,-25.31995759927745 -57.633376121520996,-25.319336915717006 -57.63331174850464,-25.317988857651912 -57.63302206993103,-25.317377862364236 -57.63294696807861,-25.317688209562228 -57.62954592704773)'; $str = $array['route']; // Get the string from the array $str = substr( $str, 11, (strlen( $str) - 1) - 11); // Get rid "LINESTRING(" and trailing ")" $objective = array(); foreach( str_getcsv( $str) as $k => $v) { list( $x, $y) = explode( ' ', $v); $objective[$k]['x'] = $x; $objective[$k]['y'] = $y; } print_r( $objective);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 36
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 36
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/WqUcl
function name:  (null)
number of ops:  41
compiled vars:  !0 = $array, !1 = $str, !2 = $objective, !3 = $v, !4 = $k, !5 = $x, !6 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                               !0, 'route'
          1        OP_DATA                                                  'LINESTRING%28-25.3233034167988+-57.640113830566406%2C-25.3229348965009+-57.64023184776306%2C-25.322653656571582+-57.63954520225525%2C-25.323410093517822+-57.63928771018982%2C-25.3229058027454+-57.6378607749939%2C-25.322973688164012+-57.63678789138794%2C-25.323371301994506+-57.63360142707825%2C-25.322003892857673+-57.633676528930664%2C-25.31995759927745+-57.633376121520996%2C-25.319336915717006+-57.63331174850464%2C-25.317988857651912+-57.63302206993103%2C-25.317377862364236+-57.63294696807861%2C-25.317688209562228+-57.62954592704773%29'
    5     2        FETCH_DIM_R                                      ~8      !0, 'route'
          3        ASSIGN                                                   !1, ~8
    6     4        INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 11
          7        STRLEN                                           ~10     !1
          8        SUB                                              ~11     ~10, 1
          9        SUB                                              ~12     ~11, 11
         10        SEND_VAL                                                 ~12
         11        DO_ICALL                                         $13     
         12        ASSIGN                                                   !1, $13
    7    13        ASSIGN                                                   !2, <array>
    9    14        INIT_FCALL                                               'str_getcsv'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $16     
         17      > FE_RESET_R                                       $17     $16, ->36
         18    > > FE_FETCH_R                                       ~18     $17, !3, ->36
         19    >   ASSIGN                                                   !4, ~18
   10    20        INIT_FCALL                                               'explode'
         21        SEND_VAL                                                 '+'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $20     
         24        FETCH_LIST_R                                     $21     $20, 0
         25        ASSIGN                                                   !5, $21
         26        FETCH_LIST_R                                     $23     $20, 1
         27        ASSIGN                                                   !6, $23
         28        FREE                                                     $20
   11    29        FETCH_DIM_W                                      $25     !2, !4
         30        ASSIGN_DIM                                               $25, 'x'
         31        OP_DATA                                                  !5
   12    32        FETCH_DIM_W                                      $27     !2, !4
         33        ASSIGN_DIM                                               $27, 'y'
         34        OP_DATA                                                  !6
    9    35      > JMP                                                      ->18
         36    >   FE_FREE                                                  $17
   15    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !2
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.84 ms | 1400 KiB | 21 Q