3v4l.org

run code in 300+ PHP versions simultaneously
<?php $end_date = new DateTime(date("Y-m-d H:i:s", strtotime("14:00"))); $begin_date = new DateTime(date("Y-m-d H:i:s", strtotime("09:15"))); echo "begin_date is " . $begin_date->format('Y-m-d H:i:s') . " and end_date is " . $end_date->format('Y-m-d H:i:s') . "<br>"; $diff = ($end_date)->diff($begin_date); $diff_in_hours = $diff->h + $diff->i / 60; echo "The difference is " . $diff->h . " hours and " . $diff->i . " minutes, which is " . $diff_in_hours . " hours<br>";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Nt3H
function name:  (null)
number of ops:  52
compiled vars:  !0 = $end_date, !1 = $begin_date, !2 = $diff, !3 = $diff_in_hours
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'DateTime'
          1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          3        INIT_FCALL                                               'strtotime'
          4        SEND_VAL                                                 '14%3A00'
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        DO_ICALL                                         $6      
          8        SEND_VAR_NO_REF_EX                                       $6
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $4
    4    11        NEW                                              $9      'DateTime'
         12        INIT_FCALL                                               'date'
         13        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         14        INIT_FCALL                                               'strtotime'
         15        SEND_VAL                                                 '09%3A15'
         16        DO_ICALL                                         $10     
         17        SEND_VAR                                                 $10
         18        DO_ICALL                                         $11     
         19        SEND_VAR_NO_REF_EX                                       $11
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !1, $9
    6    22        INIT_METHOD_CALL                                         !1, 'format'
         23        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3As'
         24        DO_FCALL                                      0  $14     
         25        CONCAT                                           ~15     'begin_date+is+', $14
         26        CONCAT                                           ~16     ~15, '+and+end_date+is+'
         27        INIT_METHOD_CALL                                         !0, 'format'
         28        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3As'
         29        DO_FCALL                                      0  $17     
         30        CONCAT                                           ~18     ~16, $17
         31        CONCAT                                           ~19     ~18, '%3Cbr%3E'
         32        ECHO                                                     ~19
    8    33        INIT_METHOD_CALL                                         !0, 'diff'
         34        SEND_VAR_EX                                              !1
         35        DO_FCALL                                      0  $20     
         36        ASSIGN                                                   !2, $20
    9    37        FETCH_OBJ_R                                      ~22     !2, 'h'
         38        FETCH_OBJ_R                                      ~23     !2, 'i'
         39        DIV                                              ~24     ~23, 60
         40        ADD                                              ~25     ~22, ~24
         41        ASSIGN                                                   !3, ~25
   10    42        FETCH_OBJ_R                                      ~27     !2, 'h'
         43        CONCAT                                           ~28     'The+difference+is+', ~27
         44        CONCAT                                           ~29     ~28, '+hours+and+'
         45        FETCH_OBJ_R                                      ~30     !2, 'i'
         46        CONCAT                                           ~31     ~29, ~30
         47        CONCAT                                           ~32     ~31, '+minutes%2C+which+is+'
         48        CONCAT                                           ~33     ~32, !3
         49        CONCAT                                           ~34     ~33, '+hours%3Cbr%3E'
         50        ECHO                                                     ~34
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173 ms | 1400 KiB | 17 Q