3v4l.org

run code in 500+ PHP versions simultaneously
<?php $json = <<<JSON { "code": 200, "unit": null, "data": [ { "2022-11-16": 185.6159202 }, { "2022-11-17": 204.31997631 } ] } JSON; $result = []; foreach (json_decode($json, true)['data'] as $item) { foreach ($item as $date => $value) { $result[] = compact(['date', 'value']); } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/8Ptld
function name:  (null)
number of ops:  25
compiled vars:  !0 = $json, !1 = $result, !2 = $item, !3 = $value, !4 = $date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%7B%0A++++%22code%22%3A+200%2C%0A++++%22unit%22%3A+null%2C%0A++++%22data%22%3A+%5B%0A++++++++%7B%0A++++++++++++%222022-11-16%22%3A+185.6159202%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++++%222022-11-17%22%3A+204.31997631%0A++++++++%7D%0A++++%5D%0A%7D'
   18     1        ASSIGN                                                       !1, <array>
   19     2        INIT_FCALL                                                   'json_decode'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     <true>
          5        DO_ICALL                                             $7      
          6        FETCH_DIM_R                                          ~8      $7, 'data'
          7      > FE_RESET_R                                           $9      ~8, ->20
          8    > > FE_FETCH_R                                                   $9, !2, ->20
   20     9    > > FE_RESET_R                                           $10     !2, ->18
         10    > > FE_FETCH_R                                           ~11     $10, !3, ->18
         11    >   ASSIGN                                                       !4, ~11
   21    12        INIT_FCALL                                                   'compact'
         13        SEND_VAL                                                     <array>
         14        DO_ICALL                                             $14     
         15        ASSIGN_DIM                                                   !1
         16        OP_DATA                                                      $14
   20    17      > JMP                                                          ->10
         18    >   FE_FREE                                                      $10
   19    19      > JMP                                                          ->8
         20    >   FE_FREE                                                      $9
   24    21        INIT_FCALL                                                   'var_export'
         22        SEND_VAR                                                     !1
         23        DO_ICALL                                                     
         24      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.42 ms | 1889 KiB | 16 Q