Using require to Load Files in PHP : require « Utility Function « PHP






Using require to Load Files in PHP

 
//File: library.inc 
<?
    function is_leapyear($year = 2004) {

        $is_leap = (!($year % 4) && (($year % 100) || !($year % 400)));
        return $is_leap;

    }
?>


<?php

    require ('library.inc');     // Parentheses are optional
    $leap = is_leapyear(2003);

?>
  
  








Related examples in the same category

1.require() operates like include(), including a template.