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 = 22
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/HLUEp
function name:  (null)
number of ops:  28
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, ->22
          3    > > FE_FETCH_R                                               $9, !2, ->22
   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
   20    10        CONCAT                                           ~16     '%0A++++++++++++%7B%0A+++++++++++++++++%22title%22%3A+%22', !3
         11        CONCAT                                           ~17     ~16, '%22%2C%0A+++++++++++++++++%22start%22%3A+%22'
   21    12        CONCAT                                           ~18     ~17, !4
         13        CONCAT                                           ~19     ~18, '%22%2C%0A+++++++++++++++++%22end%22%3A+%22'
   22    14        CONCAT                                           ~20     ~19, !5
         15        CONCAT                                           ~21     ~20, '%22%0A+++++++++++++%7D%0A++++++++++++'
   18    16        ASSIGN                                                   !6, ~21
   25    17        INIT_FCALL                                               'array_push'
         18        SEND_REF                                                 !1
         19        SEND_VAR                                                 !6
         20        DO_ICALL                                                 
   12    21      > JMP                                                      ->3
         22    >   FE_FREE                                                  $9
   30    23        INIT_FCALL                                               'json_encode'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                         $24     
         26        ECHO                                                     $24
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.28 ms | 1000 KiB | 15 Q