3v4l.org

run code in 300+ PHP versions simultaneously
<?php function datemanip(DateTime $dt) { return $dt->modify("+2 day"); } $dt = new DateTime(); $dti = new DateTimeImmutable(); datemanip($dt); // BUG! datemanip($dti); function datemanip_fixed(DateTime $dt) { return clone $dt->momdify("+2 day"); // no difference to pre 5.5 code }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bptim
function name:  (null)
number of ops:  13
compiled vars:  !0 = $dt, !1 = $dti
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'DateTime'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    8     3        NEW                                              $5      'DateTimeImmutable'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   10     6        INIT_FCALL                                               'datemanip'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0          
   11     9        INIT_FCALL                                               'datemanip'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0          
   16    12      > RETURN                                                   1

Function datemanip:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bptim
function name:  datemanip
number of ops:  6
compiled vars:  !0 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_METHOD_CALL                                         !0, 'modify'
          2        SEND_VAL_EX                                              '%2B2+day'
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
    5     5*     > RETURN                                                   null

End of function datemanip

Function datemanip_fixed:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bptim
function name:  datemanip_fixed
number of ops:  7
compiled vars:  !0 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        INIT_METHOD_CALL                                         !0, 'momdify'
          2        SEND_VAL_EX                                              '%2B2+day'
          3        DO_FCALL                                      0  $1      
          4        CLONE                                            ~2      $1
          5      > RETURN                                                   ~2
   16     6*     > RETURN                                                   null

End of function datemanip_fixed

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.89 ms | 1390 KiB | 15 Q