3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ym = date('Y-m-'); $derived_table = ''; for ($d = 1, $end = date('t'); $d <= $end; ++$d) { $date = $ym . str_pad($d, 2, 0, STR_PAD_LEFT); if ($d == 1) { $derived_table .= "SELECT '$date' AS event_date_start"; } else { $derived_table .= " UNION SELECT '$date'"; } } echo $derived_table;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 11
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 11
Branch analysis from position: 33
Branch analysis from position: 11
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 11
Branch analysis from position: 33
Branch analysis from position: 11
filename:       /in/dqQRX
function name:  (null)
number of ops:  35
compiled vars:  !0 = $ym, !1 = $derived_table, !2 = $d, !3 = $end, !4 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'Y-m-'
          2        DO_ICALL                                         $5      
          3        ASSIGN                                                   !0, $5
    3     4        ASSIGN                                                   !1, ''
    4     5        ASSIGN                                                   !2, 1
          6        INIT_FCALL                                               'date'
          7        SEND_VAL                                                 't'
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !3, $9
         10      > JMP                                                      ->31
    5    11    >   INIT_FCALL                                               'str_pad'
         12        SEND_VAR                                                 !2
         13        SEND_VAL                                                 2
         14        SEND_VAL                                                 0
         15        SEND_VAL                                                 0
         16        DO_ICALL                                         $11     
         17        CONCAT                                           ~12     !0, $11
         18        ASSIGN                                                   !4, ~12
    6    19        IS_EQUAL                                                 !2, 1
         20      > JMPZ                                                     ~14, ->26
    7    21    >   ROPE_INIT                                     3  ~16     'SELECT+%27'
         22        ROPE_ADD                                      1  ~16     ~16, !4
         23        ROPE_END                                      2  ~15     ~16, '%27+AS+event_date_start'
         24        ASSIGN_OP                                     8          !1, ~15
    6    25      > JMP                                                      ->30
    9    26    >   ROPE_INIT                                     3  ~20     '+UNION+SELECT+%27'
         27        ROPE_ADD                                      1  ~20     ~20, !4
         28        ROPE_END                                      2  ~19     ~20, '%27'
         29        ASSIGN_OP                                     8          !1, ~19
    4    30    >   PRE_INC                                                  !2
         31    >   IS_SMALLER_OR_EQUAL                                      !2, !3
         32      > JMPNZ                                                    ~24, ->11
   13    33    >   ECHO                                                     !1
   14    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
132.75 ms | 1002 KiB | 15 Q