3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fromDate = '26-1-2020'; $fromHours = '09'; $fromMins = '00'; $subtractHours = '1'; // don't bother with 3600 precalculation $subtractMins = '0'; $format = 'Y-m-d H:i:s'; $date = DateTime::createFromFormat('d-m-Y H:i:s', "{$fromDate} {$fromHours}:{$fromMins}:00"); $date->sub(new DateInterval("PT{$subtractHours}H{$subtractMins}M")); echo $date->format('Y-m-d H:i');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LTMk8
function name:  (null)
number of ops:  33
compiled vars:  !0 = $fromDate, !1 = $fromHours, !2 = $fromMins, !3 = $subtractHours, !4 = $subtractMins, !5 = $format, !6 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '26-1-2020'
    4     1        ASSIGN                                                   !1, '09'
    5     2        ASSIGN                                                   !2, '00'
    6     3        ASSIGN                                                   !3, '1'
    7     4        ASSIGN                                                   !4, '0'
    9     5        ASSIGN                                                   !5, 'Y-m-d+H%3Ai%3As'
   10     6        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          7        SEND_VAL                                                 'd-m-Y+H%3Ai%3As'
          8        ROPE_INIT                                     6  ~14     !0
          9        ROPE_ADD                                      1  ~14     ~14, '+'
         10        ROPE_ADD                                      2  ~14     ~14, !1
         11        ROPE_ADD                                      3  ~14     ~14, '%3A'
         12        ROPE_ADD                                      4  ~14     ~14, !2
         13        ROPE_END                                      5  ~13     ~14, '%3A00'
         14        SEND_VAL                                                 ~13
         15        DO_FCALL                                      0  $17     
         16        ASSIGN                                                   !6, $17
   11    17        INIT_METHOD_CALL                                         !6, 'sub'
         18        NEW                                              $19     'DateInterval'
         19        ROPE_INIT                                     5  ~21     'PT'
         20        ROPE_ADD                                      1  ~21     ~21, !3
         21        ROPE_ADD                                      2  ~21     ~21, 'H'
         22        ROPE_ADD                                      3  ~21     ~21, !4
         23        ROPE_END                                      4  ~20     ~21, 'M'
         24        SEND_VAL_EX                                              ~20
         25        DO_FCALL                                      0          
         26        SEND_VAR_NO_REF_EX                                       $19
         27        DO_FCALL                                      0          
   12    28        INIT_METHOD_CALL                                         !6, 'format'
         29        SEND_VAL_EX                                              'Y-m-d+H%3Ai'
         30        DO_FCALL                                      0  $26     
         31        ECHO                                                     $26
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.48 ms | 1435 KiB | 13 Q