3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new \DateTime('2018-01-01'); $end = new \DateTime('2019-01-01'); $interval = new \DateInterval('P1D'); $datePeriod = new \DatePeriod($start, $interval, $end); $datePeriods = iterator_to_array($datePeriod); $dates = array_rand($datePeriods, 20); shuffle($dates); while ($dates) { $d1 = array_shift($dates); $d2 = array_shift($dates); $d1 = $datePeriods[$d1]->format('Y-m-d'); $d2 = $datePeriods[$d2]->format('Y-m-d'); echo $d1 . ' < ' . $d2 . ' ' . ($d1 < $d2 ? 'true' : 'false') . \PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 31
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 31
Branch analysis from position: 61
Branch analysis from position: 31
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 31
Branch analysis from position: 61
Branch analysis from position: 31
filename:       /in/bCfZv
function name:  (null)
number of ops:  62
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $datePeriod, !4 = $datePeriods, !5 = $dates, !6 = $d1, !7 = $d2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $8      'DateTime'
          1        SEND_VAL_EX                                              '2018-01-01'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $8
    4     4        NEW                                              $11     'DateTime'
          5        SEND_VAL_EX                                              '2019-01-01'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $11
    5     8        NEW                                              $14     'DateInterval'
          9        SEND_VAL_EX                                              'P1D'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $14
    6    12        NEW                                              $17     'DatePeriod'
         13        SEND_VAR_EX                                              !0
         14        SEND_VAR_EX                                              !2
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !3, $17
    7    18        INIT_FCALL                                               'iterator_to_array'
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                         $20     
         21        ASSIGN                                                   !4, $20
    8    22        INIT_FCALL                                               'array_rand'
         23        SEND_VAR                                                 !4
         24        SEND_VAL                                                 20
         25        DO_ICALL                                         $22     
         26        ASSIGN                                                   !5, $22
    9    27        INIT_FCALL                                               'shuffle'
         28        SEND_REF                                                 !5
         29        DO_ICALL                                                 
   10    30      > JMP                                                      ->60
   11    31    >   INIT_FCALL                                               'array_shift'
         32        SEND_REF                                                 !5
         33        DO_ICALL                                         $25     
         34        ASSIGN                                                   !6, $25
   12    35        INIT_FCALL                                               'array_shift'
         36        SEND_REF                                                 !5
         37        DO_ICALL                                         $27     
         38        ASSIGN                                                   !7, $27
   13    39        FETCH_DIM_R                                      ~29     !4, !6
         40        INIT_METHOD_CALL                                         ~29, 'format'
         41        SEND_VAL_EX                                              'Y-m-d'
         42        DO_FCALL                                      0  $30     
         43        ASSIGN                                                   !6, $30
   14    44        FETCH_DIM_R                                      ~32     !4, !7
         45        INIT_METHOD_CALL                                         ~32, 'format'
         46        SEND_VAL_EX                                              'Y-m-d'
         47        DO_FCALL                                      0  $33     
         48        ASSIGN                                                   !7, $33
   15    49        CONCAT                                           ~35     !6, '+%3C+'
         50        CONCAT                                           ~36     ~35, !7
         51        CONCAT                                           ~37     ~36, '+'
         52        IS_SMALLER                                               !6, !7
         53      > JMPZ                                                     ~38, ->56
         54    >   QM_ASSIGN                                        ~39     'true'
         55      > JMP                                                      ->57
         56    >   QM_ASSIGN                                        ~39     'false'
         57    >   CONCAT                                           ~40     ~37, ~39
         58        CONCAT                                           ~41     ~40, '%0A'
         59        ECHO                                                     ~41
   10    60    > > JMPNZ                                                    !5, ->31
   16    61    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.1 ms | 1010 KiB | 17 Q