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(); $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 = 19, Position 2 = 34
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 34
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/OtOYn
function name:  (null)
number of ops:  36
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        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $6
   15     3        NEW                                              $9      'DateTime'
          4        SEND_VAL_EX                                              '%2B+4+months'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $9
   16     7        NEW                                              $12     'DateInterval'
          8        SEND_VAL_EX                                              'P5D'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $12
   17    11        NEW                                              $15     'DatePeriod'
         12        SEND_VAR_EX                                              !0
         13        SEND_VAR_EX                                              !2
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !3, $15
   18    17        ASSIGN                                                   !4, 'l+d-m-Y'
   20    18      > FE_RESET_R                                       $19     !3, ->34
         19    > > FE_FETCH_R                                               $19, !5, ->34
   21    20    >   INIT_METHOD_CALL                                         !5, 'format'
         21        SEND_VAR_EX                                              !4
         22        DO_FCALL                                      0  $20     
         23        CONCAT                                           ~21     $20, '+%3D%3E+'
         24        INIT_FCALL                                               'getsamedaynextyear'
         25        SEND_VAR                                                 !5
         26        DO_FCALL                                      0  $22     
         27        INIT_METHOD_CALL                                         $22, 'format'
         28        SEND_VAR_EX                                              !4
         29        DO_FCALL                                      0  $23     
         30        CONCAT                                           ~24     ~21, $23
         31        CONCAT                                           ~25     ~24, '%0A'
         32        ECHO                                                     ~25
   20    33      > JMP                                                      ->19
         34    >   FE_FREE                                                  $19
   22    35      > 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/OtOYn
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        ADD                                              ~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:
160.37 ms | 1457 KiB | 14 Q