3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDuration(array $times) { $startTime = new DateTime($times[0]); $endTime = $startTime->diff(new DateTime($times[1])); return "{$endTime->h}:".$endTime->format('I'); } echo getDuration(array('1:00pm', '7:00pm'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LCDT6
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'getduration'
          1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function getduration:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LCDT6
function name:  getDuration
number of ops:  25
compiled vars:  !0 = $times, !1 = $startTime, !2 = $endTime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        NEW                                              $3      'DateTime'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_DIM_FUNC_ARG                               $4      !0, 0
          4        SEND_FUNC_ARG                                            $4
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $3
    6     7        INIT_METHOD_CALL                                         !1, 'diff'
          8        NEW                                              $7      'DateTime'
          9        CHECK_FUNC_ARG                                           
         10        FETCH_DIM_FUNC_ARG                               $8      !0, 1
         11        SEND_FUNC_ARG                                            $8
         12        DO_FCALL                                      0          
         13        SEND_VAR_NO_REF_EX                                       $7
         14        DO_FCALL                                      0  $10     
         15        ASSIGN                                                   !2, $10
    8    16        FETCH_OBJ_R                                      ~12     !2, 'h'
         17        NOP                                                      
         18        FAST_CONCAT                                      ~13     ~12, '%3A'
         19        INIT_METHOD_CALL                                         !2, 'format'
         20        SEND_VAL_EX                                              'I'
         21        DO_FCALL                                      0  $14     
         22        CONCAT                                           ~15     ~13, $14
         23      > RETURN                                                   ~15
    9    24*     > RETURN                                                   null

End of function getduration

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.54 ms | 1399 KiB | 14 Q