3v4l.org

run code in 500+ PHP versions simultaneously
<?php // suppose this is your mysql data, each inner pair is a 'to', 'from' $rows = array( array(1,6), array(7,10), array(8,12) ); list($a, $b) = current($rows); $downtime = $b - $a; while( list($c, $d) = next($rows) ) { $downtime += $d - $c - max(0, min($d,$b)-$c); if( $c >= $b ) $a = $c; $b = max($b,$d); } echo "total down time is " , $downtime; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 12
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 12
Branch analysis from position: 31
Branch analysis from position: 12
Branch analysis from position: 21
filename:       /in/Q2phs
function name:  (null)
number of ops:  34
compiled vars:  !0 = $rows, !1 = $a, !2 = $b, !3 = $downtime, !4 = $d, !5 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, <array>
   10     1        INIT_FCALL                                                   'current'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $7      
          4        FETCH_LIST_R                                         $8      $7, 0
          5        ASSIGN                                                       !1, $8
          6        FETCH_LIST_R                                         $10     $7, 1
          7        ASSIGN                                                       !2, $10
          8        FREE                                                         $7
   11     9        SUB                                                  ~12     !2, !1
         10        ASSIGN                                                       !3, ~12
   13    11      > JMP                                                          ->23
   15    12    >   SUB                                                  ~14     !4, !5
         13        FRAMELESS_ICALL_2                min                 ~15     !4, !2
         14        SUB                                                  ~16     ~15, !5
         15        FRAMELESS_ICALL_2                max                 ~17     0, ~16
         16        SUB                                                  ~18     ~14, ~17
         17        ASSIGN_OP                                         1          !3, ~18
   16    18        IS_SMALLER_OR_EQUAL                                          !2, !5
         19      > JMPZ                                                         ~20, ->21
   17    20    >   ASSIGN                                                       !1, !5
   18    21    >   FRAMELESS_ICALL_2                max                 ~22     !2, !4
         22        ASSIGN                                                       !2, ~22
   13    23    >   INIT_FCALL                                                   'next'
         24        SEND_REF                                                     !0
         25        DO_ICALL                                             $24     
         26        FETCH_LIST_R                                         $25     $24, 0
         27        ASSIGN                                                       !5, $25
         28        FETCH_LIST_R                                         $27     $24, 1
         29        ASSIGN                                                       !4, $27
         30      > JMPNZ                                                        $24, ->12
   21    31    >   ECHO                                                         'total+down+time+is+'
         32        ECHO                                                         !3
   23    33      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
213.91 ms | 2901 KiB | 15 Q