3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['1 hour 3 mins','2 hours 1 min','5 mins','1 min']; Foreach($arr as $val){ $seconds =0; $temp = explode(" ", $val); Foreach(array_chunk($temp,2) as $part){ $seconds +=strtotime("+" . Implode(" ", $part)) - time(); } Echo $seconds . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 32
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 32
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 28
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 28
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 28
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/n7W3L
function name:  (null)
number of ops:  34
compiled vars:  !0 = $arr, !1 = $val, !2 = $seconds, !3 = $temp, !4 = $part
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_R                                       $6      !0, ->32
          2    > > FE_FETCH_R                                               $6, !1, ->32
    6     3    >   ASSIGN                                                   !2, 0
    7     4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '+'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !3, $8
    8     9        INIT_FCALL                                               'array_chunk'
         10        SEND_VAR                                                 !3
         11        SEND_VAL                                                 2
         12        DO_ICALL                                         $10     
         13      > FE_RESET_R                                       $11     $10, ->28
         14    > > FE_FETCH_R                                               $11, !4, ->28
    9    15    >   INIT_FCALL                                               'strtotime'
         16        INIT_FCALL                                               'implode'
         17        SEND_VAL                                                 '+'
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                         $12     
         20        CONCAT                                           ~13     '%2B', $12
         21        SEND_VAL                                                 ~13
         22        DO_ICALL                                         $14     
         23        INIT_FCALL                                               'time'
         24        DO_ICALL                                         $15     
         25        SUB                                              ~16     $14, $15
         26        ASSIGN_OP                                     1          !2, ~16
    8    27      > JMP                                                      ->14
         28    >   FE_FREE                                                  $11
   11    29        CONCAT                                           ~18     !2, '%0A'
         30        ECHO                                                     ~18
    5    31      > JMP                                                      ->2
         32    >   FE_FREE                                                  $6
   12    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.74 ms | 1015 KiB | 18 Q