3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param \DateTime $date Date of the original meeting * @return \DateTime Date of the next meeting */ function getSameDayNextYear(\DateTime $date = null) { if(!$date){ $date = new \DateTime(); } return (new \DateTime())->setISODate((int)$date->format('o') - 1, (int)$date->format('W'), (int)$date->format('N')); } $start = new \DateTime('-6 months'); $end = new \DateTime('+ 4 months'); $interval = new \DateInterval('P5D'); $period = new \DatePeriod($start, $interval, $end); $format = 'l d-m-Y'; foreach($period as $date){ echo $date->format($format) . ' => ' . getSameDayNextYear($date)->format($format) . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 35
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 35
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/862Mg
function name:  (null)
number of ops:  37
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $period, !4 = $format, !5 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $6      'DateTime'
          1        SEND_VAL_EX                                              '-6+months'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $6
   15     4        NEW                                              $9      'DateTime'
          5        SEND_VAL_EX                                              '%2B+4+months'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $9
   16     8        NEW                                              $12     'DateInterval'
          9        SEND_VAL_EX                                              'P5D'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $12
   17    12        NEW                                              $15     'DatePeriod'
         13        SEND_VAR_EX                                              !0
         14        SEND_VAR_EX                                              !2
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !3, $15
   18    18        ASSIGN                                                   !4, 'l+d-m-Y'
   20    19      > FE_RESET_R                                       $19     !3, ->35
         20    > > FE_FETCH_R                                               $19, !5, ->35
   21    21    >   INIT_METHOD_CALL                                         !5, 'format'
         22        SEND_VAR_EX                                              !4
         23        DO_FCALL                                      0  $20     
         24        CONCAT                                           ~21     $20, '+%3D%3E+'
         25        INIT_FCALL                                               'getsamedaynextyear'
         26        SEND_VAR                                                 !5
         27        DO_FCALL                                      0  $22     
         28        INIT_METHOD_CALL                                         $22, 'format'
         29        SEND_VAR_EX                                              !4
         30        DO_FCALL                                      0  $23     
         31        CONCAT                                           ~24     ~21, $23
         32        CONCAT                                           ~25     ~24, '%0A'
         33        ECHO                                                     ~25
   20    34      > JMP                                                      ->20
         35    >   FE_FREE                                                  $19
   22    36      > RETURN                                                   1

Function getsamedaynextyear:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/862Mg
function name:  getSameDayNextYear
number of ops:  28
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                        !0      null
    8     1        BOOL_NOT                                         ~1      !0
          2      > JMPZ                                                     ~1, ->6
    9     3    >   NEW                                              $2      'DateTime'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   11     6    >   NEW                                              $5      'DateTime'
          7        DO_FCALL                                      0          
          8        INIT_METHOD_CALL                                         $5, 'setISODate'
          9        INIT_METHOD_CALL                                         !0, 'format'
         10        SEND_VAL_EX                                              'o'
         11        DO_FCALL                                      0  $7      
         12        CAST                                          4  ~8      $7
         13        SUB                                              ~9      ~8, 1
         14        SEND_VAL_EX                                              ~9
         15        INIT_METHOD_CALL                                         !0, 'format'
         16        SEND_VAL_EX                                              'W'
         17        DO_FCALL                                      0  $10     
         18        CAST                                          4  ~11     $10
         19        SEND_VAL_EX                                              ~11
         20        INIT_METHOD_CALL                                         !0, 'format'
         21        SEND_VAL_EX                                              'N'
         22        DO_FCALL                                      0  $12     
         23        CAST                                          4  ~13     $12
         24        SEND_VAL_EX                                              ~13
         25        DO_FCALL                                      0  $14     
         26      > RETURN                                                   $14
   12    27*     > RETURN                                                   null

End of function getsamedaynextyear

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.26 ms | 1394 KiB | 14 Q