3v4l.org

run code in 300+ PHP versions simultaneously
<?php //dummy data $source = [ ["name" => "test1", "start" => "2022-01-12", "end" => "2022-01-13"], ["name" => "test2", "start" => "2022-01-14", "end" => "2022-01-15"], ["name" => "test3", "start" => "2022-01-16", "end" => "2022-01-17"], ]; $arr = []; foreach ($source as $item) { $name = $item["name"]; $start = $item["start"]; $end = $item["end"]; $r = [ "title" => $name, "start" => $start, "end" => $end ]; array_push($arr, $r); } //var_dump($arr); echo json_encode($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/2rlOG
function name:  (null)
number of ops:  25
compiled vars:  !0 = $source, !1 = $arr, !2 = $item, !3 = $name, !4 = $start, !5 = $end, !6 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   12     2      > FE_RESET_R                                       $9      !0, ->19
          3    > > FE_FETCH_R                                               $9, !2, ->19
   14     4    >   FETCH_DIM_R                                      ~10     !2, 'name'
          5        ASSIGN                                                   !3, ~10
   15     6        FETCH_DIM_R                                      ~12     !2, 'start'
          7        ASSIGN                                                   !4, ~12
   16     8        FETCH_DIM_R                                      ~14     !2, 'end'
          9        ASSIGN                                                   !5, ~14
   19    10        INIT_ARRAY                                       ~16     !3, 'title'
   20    11        ADD_ARRAY_ELEMENT                                ~16     !4, 'start'
   21    12        ADD_ARRAY_ELEMENT                                ~16     !5, 'end'
   18    13        ASSIGN                                                   !6, ~16
   23    14        INIT_FCALL                                               'array_push'
         15        SEND_REF                                                 !1
         16        SEND_VAR                                                 !6
         17        DO_ICALL                                                 
   12    18      > JMP                                                      ->3
         19    >   FE_FREE                                                  $9
   28    20        INIT_FCALL                                               'json_encode'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $19     
         23        ECHO                                                     $19
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.96 ms | 999 KiB | 15 Q