3v4l.org

run code in 300+ PHP versions simultaneously
<?php function testCode($voucher) { $eternalCodes = array( 'SNOWFALL', 'SASCREWS236C', 'FREELOAD5RTPYG', 'MCCOCT8J6WA', 'RKM6SH7UB', ); $temporaryCodes = array( 'SASCREWS236C' => array( 'from' => '2018-01-30', 'to' => '2018-12-31', ), 'SASAPRCQ4CD' => array( 'from' => '2018-04-01', 'to' => '2018-05-01', ), 'SASJUN8A39N' => array( 'from' => '2018-06-01', 'to' => '2018-07-01', ), 'SASJUL3NU24' => array( 'from' => '2018-07-01', 'to' => '2018-08-01', ), 'SASAUGWX4ZV' => array( 'from' => '2018-08-01', 'to' => '2018-11-01', ), ); $time = time(); foreach ($temporaryCodes as $code => $dates) { if ($voucher === $code && strtotime($dates['from'].' 00:00:00') <= $time && $time <= strtotime($dates['to'].' 23:59:59')) { return true; } } if (in_array($voucher, $eternalCodes, true) === true) { return true; } return false; } var_dump(testCode('SASAPRCQ4CD'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3mbk3
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'testcode'
          2        SEND_VAL                                                 'SASAPRCQ4CD'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function testcode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 30
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 30
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 26
Branch analysis from position: 18
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 39
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/3mbk3
function name:  testCode
number of ops:  41
compiled vars:  !0 = $voucher, !1 = $eternalCodes, !2 = $temporaryCodes, !3 = $time, !4 = $dates, !5 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
   13     2        ASSIGN                                                   !2, <array>
   36     3        INIT_FCALL                                               'time'
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !3, $8
   38     6      > FE_RESET_R                                       $10     !2, ->30
          7    > > FE_FETCH_R                                       ~11     $10, !4, ->30
          8    >   ASSIGN                                                   !5, ~11
   39     9        IS_IDENTICAL                                     ~13     !0, !5
         10      > JMPZ_EX                                          ~13     ~13, ->18
   40    11    >   INIT_FCALL                                               'strtotime'
         12        FETCH_DIM_R                                      ~14     !4, 'from'
         13        CONCAT                                           ~15     ~14, '+00%3A00%3A00'
         14        SEND_VAL                                                 ~15
         15        DO_ICALL                                         $16     
         16        IS_SMALLER_OR_EQUAL                              ~17     $16, !3
         17        BOOL                                             ~13     ~17
         18    > > JMPZ_EX                                          ~13     ~13, ->26
   41    19    >   INIT_FCALL                                               'strtotime'
         20        FETCH_DIM_R                                      ~18     !4, 'to'
         21        CONCAT                                           ~19     ~18, '+23%3A59%3A59'
         22        SEND_VAL                                                 ~19
         23        DO_ICALL                                         $20     
         24        IS_SMALLER_OR_EQUAL                              ~21     !3, $20
         25        BOOL                                             ~13     ~21
         26    > > JMPZ                                                     ~13, ->29
   42    27    >   FE_FREE                                                  $10
         28      > RETURN                                                   <true>
   38    29    > > JMP                                                      ->7
         30    >   FE_FREE                                                  $10
   46    31        INIT_FCALL                                               'in_array'
         32        SEND_VAR                                                 !0
         33        SEND_VAR                                                 !1
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $22     
         36        TYPE_CHECK                                    8          $22
         37      > JMPZ                                                     ~23, ->39
   47    38    > > RETURN                                                   <true>
   50    39    > > RETURN                                                   <false>
   51    40*     > RETURN                                                   null

End of function testcode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.5 ms | 1403 KiB | 22 Q