3v4l.org

run code in 500+ PHP versions simultaneously
<?php $jobs = [ [ 'id' => 9, 'needed_at' => '2023-02-26 03:31:04', 'ended_at' => '2023-02-26 04:31:04', 'add' => 20 ], [ 'id' => 6, 'needed_at' => '2023-02-26 04:51:04', 'ended_at' => '2023-02-26 05:51:04', 'add' => 30 ], [ 'id' => 7, 'needed_at' => '2023-02-26 09:21:04', 'ended_at' => '2023-02-26 10:21:04', 'add' => 30 ] ]; $format = 'Y-m-d H:i:s'; foreach ($jobs as &$row) { $dt ??= new DateTime($row['needed_at']); $row['needed_at'] = $dt->format($format); $dt->modify('+ 60 minutes'); $row['ended_at'] = $dt->format($format); $dt->modify("+ {$row['add']} minutes"); } var_export($jobs);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 34
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 34
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/Xr54K
function name:  (null)
number of ops:  39
compiled vars:  !0 = $jobs, !1 = $format, !2 = $row, !3 = $dt
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   24     1        ASSIGN                                                       !1, 'Y-m-d+H%3Ai%3As'
   25     2      > FE_RESET_RW                                          $6      !0, ->34
          3    > > FE_FETCH_RW                                                  $6, !2, ->34
   26     4    >   COALESCE                                             ~7      !3
          5        NEW                                                  $8      'DateTime'
          6        CHECK_FUNC_ARG                                               
          7        FETCH_DIM_FUNC_ARG                                   $9      !2, 'needed_at'
          8        SEND_FUNC_ARG                                                $9
          9        DO_FCALL                                          0          
         10        ASSIGN                                               ~11     !3, $8
         11        QM_ASSIGN                                            ~7      ~11
         12        FREE                                                         ~7
   27    13        INIT_METHOD_CALL                                             !3, 'format'
         14        SEND_VAR_EX                                                  !1
         15        DO_FCALL                                          0  $13     
         16        ASSIGN_DIM                                                   !2, 'needed_at'
         17        OP_DATA                                                      $13
   28    18        INIT_METHOD_CALL                                             !3, 'modify'
         19        SEND_VAL_EX                                                  '%2B+60+minutes'
         20        DO_FCALL                                          0          
   29    21        INIT_METHOD_CALL                                             !3, 'format'
         22        SEND_VAR_EX                                                  !1
         23        DO_FCALL                                          0  $16     
         24        ASSIGN_DIM                                                   !2, 'ended_at'
         25        OP_DATA                                                      $16
   30    26        INIT_METHOD_CALL                                             !3, 'modify'
         27        ROPE_INIT                                         3  ~19     '%2B+'
         28        FETCH_DIM_R                                          ~17     !2, 'add'
         29        ROPE_ADD                                          1  ~19     ~19, ~17
         30        ROPE_END                                          2  ~18     ~19, '+minutes'
         31        SEND_VAL_EX                                                  ~18
         32        DO_FCALL                                          0          
   25    33      > JMP                                                          ->3
         34    >   FE_FREE                                                      $6
   33    35        INIT_FCALL                                                   'var_export'
         36        SEND_VAR                                                     !0
         37        DO_ICALL                                                     
         38      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
260.22 ms | 1781 KiB | 14 Q