3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dates = ['04 Mar 15', '14 Apr 15', '27 Aug 15']; $format_dates = []; $insert_dates = ""; foreach($dates as $raw_date) { $str_to_date = DateTime::createFromFormat('d M y', $raw_date); $format_dates[] = $str_to_date->format('Y-m-d'); } $date_array = new ArrayIterator($format_dates); $c_date_array = new CachingIterator($date_array); foreach($c_date_array as $date) { $insert_dates .= "($date, $dev_id)"; if ($c_date_array->hasNext()) { $insert_dates .= ", "; } } echo $insert_dates; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 38
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 38
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 37
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 37
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 16
filename:       /in/Wm2WZ
function name:  (null)
number of ops:  41
compiled vars:  !0 = $dates, !1 = $format_dates, !2 = $insert_dates, !3 = $raw_date, !4 = $str_to_date, !5 = $date_array, !6 = $c_date_array, !7 = $date, !8 = $dev_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, ''
    7     3      > FE_RESET_R                                       $12     !0, ->16
          4    > > FE_FETCH_R                                               $12, !3, ->16
    8     5    >   INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          6        SEND_VAL                                                 'd+M+y'
          7        SEND_VAR                                                 !3
          8        DO_FCALL                                      0  $13     
          9        ASSIGN                                                   !4, $13
    9    10        INIT_METHOD_CALL                                         !4, 'format'
         11        SEND_VAL_EX                                              'Y-m-d'
         12        DO_FCALL                                      0  $16     
         13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  $16
    7    15      > JMP                                                      ->4
         16    >   FE_FREE                                                  $12
   12    17        NEW                                              $17     'ArrayIterator'
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !5, $17
   13    21        NEW                                              $20     'CachingIterator'
         22        SEND_VAR_EX                                              !5
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !6, $20
   15    25      > FE_RESET_R                                       $23     !6, ->38
         26    > > FE_FETCH_R                                               $23, !7, ->38
   16    27    >   ROPE_INIT                                     5  ~25     '%28'
         28        ROPE_ADD                                      1  ~25     ~25, !7
         29        ROPE_ADD                                      2  ~25     ~25, '%2C+'
         30        ROPE_ADD                                      3  ~25     ~25, !8
         31        ROPE_END                                      4  ~24     ~25, '%29'
         32        ASSIGN_OP                                     8          !2, ~24
   17    33        INIT_METHOD_CALL                                         !6, 'hasNext'
         34        DO_FCALL                                      0  $29     
         35      > JMPZ                                                     $29, ->37
   18    36    >   ASSIGN_OP                                     8          !2, '%2C+'
   15    37    > > JMP                                                      ->26
         38    >   FE_FREE                                                  $23
   22    39        ECHO                                                     !2
   23    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.35 ms | 1399 KiB | 13 Q