Search
 
SCRIPT & CODE EXAMPLE
 

PHP

How to check leap year in php?

$year = 2014;
// Leap years are divisible by 400 or by 4 but not 100
if(($year % 400 == 0) || (($year % 100 == 0) && ($year % 4 == 0))){
    echo "$year is a leap year.";
} else{
    echo "$year is normal year.";
}
Comment

php Program to check if a given year is leap year

<?php
// PHP code to check if a given
// year is leap year
 
function checkYear($year)
{
    // If a year is multiple of 400,
    // then it is a leap year
    if ($year % 400 == 0)
        print("Leap Year");
         
    // Else If a year is multiple of 100,
    // then it is not a leap year
    else if ($year % 100 == 0)
        print("Not a Leap Year");
             
    // Else If a year is multiple of 4,
    // then it is a leap year
    else if ($year % 4 == 0)
        print("Leap Year");
         
    else
        print("Not a Leap Year");
}
 
// Driver code
$year = 2000;
 
checkYear($year);
     
// This code is contributed by ash264
?>
Comment

PREVIOUS NEXT
Code Example
Php :: Composer detected issues in your platform: Your Composer dependencies require a PHP version "= 8.0.2". 
Php :: clear laravel cache 
Php :: php translate url wpml 
Php :: request old laravel form select 
Php :: laravel vue csrf 
Php :: Displaying all table names in php from MySQL database 
Php :: create new laravel project cmd 
Php :: php convert object to array 
Php :: laravel wherehas 
Php :: Get Parameters From a URL String in PHP 
Php :: wordpress get user by id 
Php :: php how to rename a file before saving it 
Php :: add column in table laravel 
Php :: array_map class method 
Php :: php serialize 
Php :: How to get only year, month and day from timestamp in Laravel 
Php :: file_get_contents url fail 
Php :: wordpress get link to post by id 
Php :: how to search in sentence laravel 
Php :: php get extension from file from form submit 
Php :: display all custom post type ids 
Php :: laravel chunkbyid 
Php :: php serverpath 
Php :: Woocommerce Display field value on the admin order edit page [Custom Field Display 2] 
Php :: mysql get the last id php 
Php :: How To Force Redirect HTTP To HTTPS In Laravel Using htaccess 
Php :: laravel date set timezone 
Php :: is users logged in laravel blade 
Php :: how match array in laravel collection 
Php :: php insert character into string 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =