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 getSameDayLastYear(\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('-5 years'); $end = new \DateTime('-3 years'); $interval = new \DateInterval('P1D'); $period = new \DatePeriod($start, $interval, $end); $format = 'Y-m-d'; echo "insert ignore into TblDatesDev (date, lastYear) VALUES \n"; foreach($period as $date){ echo "('".$date->format($format)."','".getSameDayLastYear($date)->format($format)."'),\n"; //echo $date->format($format) . ' => ' . getSameDayLastYear($date)->format($format) . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 37
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 37
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/sOQcY
function name:  (null)
number of ops:  39
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                                              '-5+years'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $6
   15     4        NEW                                              $9      'DateTime'
          5        SEND_VAL_EX                                              '-3+years'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $9
   16     8        NEW                                              $12     'DateInterval'
          9        SEND_VAL_EX                                              'P1D'
         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, 'Y-m-d'
   19    19        ECHO                                                     'insert+ignore+into+TblDatesDev+%28date%2C+lastYear%29+VALUES+%0A'
   20    20      > FE_RESET_R                                       $19     !3, ->37
         21    > > FE_FETCH_R                                               $19, !5, ->37
   21    22    >   INIT_METHOD_CALL                                         !5, 'format'
         23        SEND_VAR_EX                                              !4
         24        DO_FCALL                                      0  $20     
         25        CONCAT                                           ~21     '%28%27', $20
         26        CONCAT                                           ~22     ~21, '%27%2C%27'
         27        INIT_FCALL                                               'getsamedaylastyear'
         28        SEND_VAR                                                 !5
         29        DO_FCALL                                      0  $23     
         30        INIT_METHOD_CALL                                         $23, 'format'
         31        SEND_VAR_EX                                              !4
         32        DO_FCALL                                      0  $24     
         33        CONCAT                                           ~25     ~22, $24
         34        CONCAT                                           ~26     ~25, '%27%29%2C%0A'
         35        ECHO                                                     ~26
   20    36      > JMP                                                      ->21
         37    >   FE_FREE                                                  $19
   23    38      > RETURN                                                   1

Function getsamedaylastyear:
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/sOQcY
function name:  getSameDayLastYear
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 getsamedaylastyear

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.55 ms | 1394 KiB | 14 Q