3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_leap_year(int $year) :bool { return $year % 4 == 0 and ($year % 100 != 0 or $year % 400 == 0); } $year = 2016; var_dump(is_leap_year($year)); # true var_dump( (bool) date('L', $year)); $year = 2018; var_dump(is_leap_year($year) === date('L', $year)); # false var_dump( (bool) date('L', $year));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LU85M
function name:  (null)
number of ops:  36
compiled vars:  !0 = $year
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 2016
    8     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'is_leap_year'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
    9     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'date'
          9        SEND_VAL                                                 'L'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $4      
         12        BOOL                                             ~5      $4
         13        SEND_VAL                                                 ~5
         14        DO_ICALL                                                 
   11    15        ASSIGN                                                   !0, 2018
   12    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'is_leap_year'
         18        SEND_VAR                                                 !0
         19        DO_FCALL                                      0  $8      
         20        INIT_FCALL                                               'date'
         21        SEND_VAL                                                 'L'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $9      
         24        IS_IDENTICAL                                     ~10     $8, $9
         25        SEND_VAL                                                 ~10
         26        DO_ICALL                                                 
   13    27        INIT_FCALL                                               'var_dump'
         28        INIT_FCALL                                               'date'
         29        SEND_VAL                                                 'L'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $12     
         32        BOOL                                             ~13     $12
         33        SEND_VAL                                                 ~13
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Function is_leap_year:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 11
filename:       /in/LU85M
function name:  is_leap_year
number of ops:  15
compiled vars:  !0 = $year
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        MOD                                              ~1      !0, 4
          2        IS_EQUAL                                         ~2      ~1, 0
          3      > JMPZ_EX                                          ~2      ~2, ->11
          4    >   MOD                                              ~3      !0, 100
          5        IS_NOT_EQUAL                                     ~4      ~3, 0
          6      > JMPNZ_EX                                         ~4      ~4, ->10
          7    >   MOD                                              ~5      !0, 400
          8        IS_EQUAL                                         ~6      ~5, 0
          9        BOOL                                             ~4      ~6
         10    >   BOOL                                             ~2      ~4
         11    >   VERIFY_RETURN_TYPE                                       ~2
         12      > RETURN                                                   ~2
    5    13*       VERIFY_RETURN_TYPE                                       
         14*     > RETURN                                                   null

End of function is_leap_year

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.01 ms | 1403 KiB | 19 Q