3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Add/Subtract days from a date function dateMath($startDate, $math) { $math = $math." day"; $date = new DateTime($startDate); $date->modify($math); return($date->format('Y-m-d')); } echo dateMath('2016-11-17', -1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SJRBs
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'datemath'
          1        SEND_VAL                                                 '2016-11-17'
          2        SEND_VAL                                                 -1
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function datemath:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SJRBs
function name:  dateMath
number of ops:  16
compiled vars:  !0 = $startDate, !1 = $math, !2 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        CONCAT                                           ~3      !1, '+day'
          3        ASSIGN                                                   !1, ~3
    7     4        NEW                                              $5      'DateTime'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $5
    8     8        INIT_METHOD_CALL                                         !2, 'modify'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
    9    11        INIT_METHOD_CALL                                         !2, 'format'
         12        SEND_VAL_EX                                              'Y-m-d'
         13        DO_FCALL                                      0  $9      
         14      > RETURN                                                   $9
   10    15*     > RETURN                                                   null

End of function datemath

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.98 ms | 1398 KiB | 14 Q