3v4l.org

run code in 500+ PHP versions simultaneously
<?php $points = Array ( Array ( 45.29077, 5.63361 ), Array ( 45.29083, 5.63384 ) ); echo 'points = '; print_r($points); $json_parcours = array("type"=>"FeatureCollection", "features"=>array()); $coord_bdd = array(); foreach($points as $value){ //echo gettype($value[1]).' : '; $round1 = substr($value[1],0,7); $round2 = sprintf('%f.5', $value[0]); $round1 = floatval($round1); $round2 = floatval($round2); array_push($coord_bdd,array($round1,$round2)); //echo $round1.', '.$round2.'<br />'; echo '<br/><br/>coord_bdd = '; print_r($coord_bdd); } array_push($json_parcours["features"],array("type"=>"Feature","geometry"=>array("type"=>"LineString","coordinates"=>$coord_bdd),"properties"=>array())); $jsonData = json_encode($json_parcours,JSON_UNESCAPED_UNICODE); // Convertir le tableau en JSON echo '<br/><br/>jsonData = '; print_r($jsonData);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 34
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 34
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/QZgUn
function name:  (null)
number of ops:  55
compiled vars:  !0 = $points, !1 = $json_parcours, !2 = $coord_bdd, !3 = $value, !4 = $round1, !5 = $round2, !6 = $jsonData
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                       !0, <array>
    7     1        ECHO                                                         'points+%3D+'
    8     2        INIT_FCALL                                                   'print_r'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                                     
   10     5        ASSIGN                                                       !1, <array>
   11     6        ASSIGN                                                       !2, <array>
   13     7      > FE_RESET_R                                           $11     !0, ->34
          8    > > FE_FETCH_R                                                   $11, !3, ->34
   15     9    >   FETCH_DIM_R                                          ~12     !3, 1
         10        FRAMELESS_ICALL_3                substr              ~13     ~12, 0
         11        OP_DATA                                                      7
         12        ASSIGN                                                       !4, ~13
   16    13        INIT_FCALL                                                   'sprintf'
         14        SEND_VAL                                                     '%25f.5'
         15        FETCH_DIM_R                                          ~15     !3, 0
         16        SEND_VAL                                                     ~15
         17        DO_ICALL                                             $16     
         18        ASSIGN                                                       !5, $16
   17    19        CAST                                              5  ~18     !4
         20        ASSIGN                                                       !4, ~18
   18    21        CAST                                              5  ~20     !5
         22        ASSIGN                                                       !5, ~20
   19    23        INIT_FCALL                                                   'array_push'
         24        SEND_REF                                                     !2
         25        INIT_ARRAY                                           ~22     !4
         26        ADD_ARRAY_ELEMENT                                    ~22     !5
         27        SEND_VAL                                                     ~22
         28        DO_ICALL                                                     
   22    29        ECHO                                                         '%3Cbr%2F%3E%3Cbr%2F%3Ecoord_bdd+%3D+'
   23    30        INIT_FCALL                                                   'print_r'
         31        SEND_VAR                                                     !2
         32        DO_ICALL                                                     
   13    33      > JMP                                                          ->8
         34    >   FE_FREE                                                      $11
   26    35        INIT_FCALL                                                   'array_push'
         36        FETCH_DIM_W                                          $25     !1, 'features'
         37        SEND_REF                                                     $25
         38        INIT_ARRAY                                           ~26     'Feature', 'type'
         39        INIT_ARRAY                                           ~27     'LineString', 'type'
         40        ADD_ARRAY_ELEMENT                                    ~27     !2, 'coordinates'
         41        ADD_ARRAY_ELEMENT                                    ~26     ~27, 'geometry'
         42        ADD_ARRAY_ELEMENT                                    ~26     <array>, 'properties'
         43        SEND_VAL                                                     ~26
         44        DO_ICALL                                                     
   28    45        INIT_FCALL                                                   'json_encode'
         46        SEND_VAR                                                     !1
         47        SEND_VAL                                                     256
         48        DO_ICALL                                             $29     
         49        ASSIGN                                                       !6, $29
   30    50        ECHO                                                         '%3Cbr%2F%3E%3Cbr%2F%3EjsonData+%3D+'
   31    51        INIT_FCALL                                                   'print_r'
         52        SEND_VAR                                                     !6
         53        DO_ICALL                                                     
         54      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.99 ms | 1386 KiB | 17 Q