3v4l.org

run code in 300+ PHP versions simultaneously
<?php $current_day = date('N'); // Current day of the week as a number (1-7) - Sunday is first day of the week $current_hour = date('H'); // Current hour in 24 hr format if($current_day < 6) { // Check if it's Monday - Friday if($current_hour > 1 && $current_hour < 9) { // time is between 1 and 9 AM $image = 'OPEN'; } elseif($current_hour > 9 && $current_hour < 18) { // time is between 9 am and 6 pm $image = 'OPEN'; } elseif($current_hour > 18 && $current_hour < 23) { // time is between 6 pm and 11 pm $image = 'CLOSED'; } else { // time is none of the above $image = 'CLOSED'; } } else { $image = 'NOTHING'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 33
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 28
Branch analysis from position: 21
Branch analysis from position: 14
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YpLBc
function name:  (null)
number of ops:  35
compiled vars:  !0 = $current_day, !1 = $current_hour, !2 = $image
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'N'
          2        DO_ICALL                                         $3      
          3        ASSIGN                                                   !0, $3
    3     4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'H'
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
    4     8        IS_SMALLER                                               !0, 6
          9      > JMPZ                                                     ~7, ->33
    5    10    >   IS_SMALLER                                       ~8      1, !1
         11      > JMPZ_EX                                          ~8      ~8, ->14
         12    >   IS_SMALLER                                       ~9      !1, 9
         13        BOOL                                             ~8      ~9
         14    > > JMPZ                                                     ~8, ->17
    6    15    >   ASSIGN                                                   !2, 'OPEN'
         16      > JMP                                                      ->32
    8    17    >   IS_SMALLER                                       ~11     9, !1
         18      > JMPZ_EX                                          ~11     ~11, ->21
         19    >   IS_SMALLER                                       ~12     !1, 18
         20        BOOL                                             ~11     ~12
         21    > > JMPZ                                                     ~11, ->24
    9    22    >   ASSIGN                                                   !2, 'OPEN'
         23      > JMP                                                      ->32
   11    24    >   IS_SMALLER                                       ~14     18, !1
         25      > JMPZ_EX                                          ~14     ~14, ->28
         26    >   IS_SMALLER                                       ~15     !1, 23
         27        BOOL                                             ~14     ~15
         28    > > JMPZ                                                     ~14, ->31
   12    29    >   ASSIGN                                                   !2, 'CLOSED'
         30      > JMP                                                      ->32
   15    31    >   ASSIGN                                                   !2, 'CLOSED'
         32    > > JMP                                                      ->34
   19    33    >   ASSIGN                                                   !2, 'NOTHING'
   20    34    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.4 ms | 1400 KiB | 15 Q