3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dates = array('2019-03-20 00:00:00', '2019-03-20 02:30:00', '2019-03-20 05:00:00', '2019-03-20 14:30:00', '2019-03-20 23:59:59'); $now = date('Y-m-d H:i:s'); $latest = ''; foreach ($dates as $date) { if ($date > $now) break; $latest = $date; } echo $latest;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 13
Branch analysis from position: 13
filename:       /in/caVNf
function name:  (null)
number of ops:  16
compiled vars:  !0 = $dates, !1 = $now, !2 = $latest, !3 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    9     5        ASSIGN                                                   !2, ''
   10     6      > FE_RESET_R                                       $8      !0, ->13
          7    > > FE_FETCH_R                                               $8, !3, ->13
   11     8    >   IS_SMALLER                                               !1, !3
          9      > JMPZ                                                     ~9, ->11
         10    > > JMP                                                      ->13
   12    11    >   ASSIGN                                                   !2, !3
   10    12      > JMP                                                      ->7
         13    >   FE_FREE                                                  $8
   14    14        ECHO                                                     !2
   15    15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.77 ms | 1001 KiB | 14 Q