3v4l.org

run code in 300+ 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 = 37
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 37
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/QZgUn
function name:  (null)
number of ops:  58
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, ->37
          8    > > FE_FETCH_R                                               $11, !3, ->37
   15     9    >   INIT_FCALL                                               'substr'
         10        FETCH_DIM_R                                      ~12     !3, 1
         11        SEND_VAL                                                 ~12
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 7
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !4, $13
   16    16        INIT_FCALL                                               'sprintf'
         17        SEND_VAL                                                 '%25f.5'
         18        FETCH_DIM_R                                      ~15     !3, 0
         19        SEND_VAL                                                 ~15
         20        DO_ICALL                                         $16     
         21        ASSIGN                                                   !5, $16
   17    22        CAST                                          5  ~18     !4
         23        ASSIGN                                                   !4, ~18
   18    24        CAST                                          5  ~20     !5
         25        ASSIGN                                                   !5, ~20
   19    26        INIT_FCALL                                               'array_push'
         27        SEND_REF                                                 !2
         28        INIT_ARRAY                                       ~22     !4
         29        ADD_ARRAY_ELEMENT                                ~22     !5
         30        SEND_VAL                                                 ~22
         31        DO_ICALL                                                 
   22    32        ECHO                                                     '%3Cbr%2F%3E%3Cbr%2F%3Ecoord_bdd+%3D+'
   23    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                                 
   13    36      > JMP                                                      ->8
         37    >   FE_FREE                                                  $11
   26    38        INIT_FCALL                                               'array_push'
         39        FETCH_DIM_W                                      $25     !1, 'features'
         40        SEND_REF                                                 $25
         41        INIT_ARRAY                                       ~26     'Feature', 'type'
         42        INIT_ARRAY                                       ~27     'LineString', 'type'
         43        ADD_ARRAY_ELEMENT                                ~27     !2, 'coordinates'
         44        ADD_ARRAY_ELEMENT                                ~26     ~27, 'geometry'
         45        ADD_ARRAY_ELEMENT                                ~26     <array>, 'properties'
         46        SEND_VAL                                                 ~26
         47        DO_ICALL                                                 
   28    48        INIT_FCALL                                               'json_encode'
         49        SEND_VAR                                                 !1
         50        SEND_VAL                                                 256
         51        DO_ICALL                                         $29     
         52        ASSIGN                                                   !6, $29
   30    53        ECHO                                                     '%3Cbr%2F%3E%3Cbr%2F%3EjsonData+%3D+'
   31    54        INIT_FCALL                                               'print_r'
         55        SEND_VAR                                                 !6
         56        DO_ICALL                                                 
         57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.46 ms | 1009 KiB | 18 Q