3v4l.org

run code in 300+ PHP versions simultaneously
<?php function roundToNextHour($dateString) { $date = new DateTime( $dateString ); $minutes = $date->format('i'); if($minutes > 0){ $date->modify("+1 hour"); $date->modify('-'.$minutes.' minutes'); } return $date; } echo roundToNextHour(date());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A4Aoo
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'roundtonexthour'
          1        INIT_FCALL                                               'date'
          2        DO_ICALL                                         $0      
          3        SEND_VAR                                                 $0
          4        DO_FCALL                                      0  $1      
          5        ECHO                                                     $1
          6      > RETURN                                                   1

Function roundtonexthour:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/A4Aoo
function name:  roundToNextHour
number of ops:  21
compiled vars:  !0 = $dateString, !1 = $date, !2 = $minutes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        NEW                                              $3      'DateTime'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
    5     5        INIT_METHOD_CALL                                         !1, 'format'
          6        SEND_VAL_EX                                              'i'
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !2, $6
    6     9        IS_SMALLER                                               0, !2
         10      > JMPZ                                                     ~8, ->19
    7    11    >   INIT_METHOD_CALL                                         !1, 'modify'
         12        SEND_VAL_EX                                              '%2B1+hour'
         13        DO_FCALL                                      0          
    8    14        INIT_METHOD_CALL                                         !1, 'modify'
         15        CONCAT                                           ~10     '-', !2
         16        CONCAT                                           ~11     ~10, '+minutes'
         17        SEND_VAL_EX                                              ~11
         18        DO_FCALL                                      0          
   10    19    > > RETURN                                                   !1
   11    20*     > RETURN                                                   null

End of function roundtonexthour

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.7 ms | 1399 KiB | 16 Q