Current Date ,time ,day ,years Program



Returning value 
 


      Some PHP function returns value when called and the nature of the returned value may be determined by the argument passed  . 

for example 

          The built-in-date() function accept a whole range of argument to determine how date information should be formatted for return to the caller 


Argument     Description                    Example 

    Y            Year as four digit              2020

    y            Years as two digit                14
    
      n            Month as one or two digit      7

    m           Month as two digit                07

    F            Month full name                 February 

    M           Month as three latter             Feb

    j            Day as one or two digit            4

   d             Day as two digit                     04

   l              day full name                    Monday 

   D            Day as three letter               Mon

   S           Ordinal suffix as two letter      th

   H            24 hour format                   14

   i             Minutes                              45

   s            Second                               30




Your own custom function can also be made to return a value when called simply by using the return keyword in a statement followed by the value that is to be returned .    

PHP Program

<?php
     date_default_timezone_set('UTC');

     function disply_date()
      {
          return date ('l,F d');
      }
      echo disply_date();

?>



Output



    

Comments

Popular posts from this blog

Switching Branches