3v4l.org

run code in 500+ 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'; $date = new \DateTime('2014-05-23'); for($i = 0; $i < 100; $i++){ echo $date->format($format) . "\n"; $date = getSameDayNextYear($date); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 24
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 24
Branch analysis from position: 36
Branch analysis from position: 24
filename:       /in/3cLIS
function name:  (null)
number of ops:  37
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $period, !4 = $format, !5 = $date, !6 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   NEW                                                  $7      'DateTime'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $7
   15     3        NEW                                                  $10     'DateTime'
          4        SEND_VAL_EX                                                  '%2B+4+months'
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !1, $10
   16     7        NEW                                                  $13     'DateInterval'
          8        SEND_VAL_EX                                                  'P5D'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !2, $13
   17    11        NEW                                                  $16     'DatePeriod'
         12        SEND_VAR_EX                                                  !0
         13        SEND_VAR_EX                                                  !2
         14        SEND_VAR_EX                                                  !1
         15        DO_FCALL                                          0          
         16        ASSIGN                                                       !3, $16
   18    17        ASSIGN                                                       !4, 'l+d-m-Y'
   20    18        NEW                                                  $20     'DateTime'
         19        SEND_VAL_EX                                                  '2014-05-23'
         20        DO_FCALL                                          0          
         21        ASSIGN                                                       !5, $20
   22    22        ASSIGN                                                       !6, 0
         23      > JMP                                                          ->34
   23    24    >   INIT_METHOD_CALL                                             !5, 'format'
         25        SEND_VAR_EX                                                  !4
         26        DO_FCALL                                          0  $24     
         27        CONCAT                                               ~25     $24, '%0A'
         28        ECHO                                                         ~25
   24    29        INIT_FCALL                                                   'getsamedaynextyear'
         30        SEND_VAR                                                     !5
         31        DO_FCALL                                          0  $26     
         32        ASSIGN                                                       !5, $26
   22    33        PRE_INC                                                      !6
         34    >   IS_SMALLER                                                   !6, 100
         35      > JMPNZ                                                        ~29, ->24
   25    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/3cLIS
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.5.0


preferences:
200.3 ms | 3218 KiB | 14 Q