3v4l.org

run code in 300+ PHP versions simultaneously
<?php $years = 5; $baseDate = new \DateTime(); $baseDate = new \DateTime($baseDate->format('Y-m-01 00:00:00')); $baseDate->modify('-' . $years . ' years'); var_dump($baseDate);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n03ga
function name:  (null)
number of ops:  20
compiled vars:  !0 = $years, !1 = $baseDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 5
    5     1        NEW                                              $3      'DateTime'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
    6     4        NEW                                              $6      'DateTime'
          5        INIT_METHOD_CALL                                         !1, 'format'
          6        SEND_VAL_EX                                              'Y-m-01+00%3A00%3A00'
          7        DO_FCALL                                      0  $7      
          8        SEND_VAR_NO_REF_EX                                       $7
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $6
    7    11        INIT_METHOD_CALL                                         !1, 'modify'
         12        CONCAT                                           ~10     '-', !0
         13        CONCAT                                           ~11     ~10, '+years'
         14        SEND_VAL_EX                                              ~11
         15        DO_FCALL                                      0          
    9    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.26 ms | 1451 KiB | 14 Q