Do you Know date, Array, push, To string in PHP | Php tutorials

Started by Sharmait007, September 09, 2011, 03:45:39 AM

Sharmait007

The PHP date()
The PHP date() function is used to display time and date.
Syntax:
date(format,timestamp)
example:
<?

$d = date("F j, Y, g:i a");

?>
<?php
   echo date("Y-m-d");
   echo date("Y/m/d");
   echo date("M d, Y");
   echo date("F d, Y");
   echo date("D M d, Y");
   echo date("l F d, Y");
   echo date("l F d, Y, h:i:s");
   echo date("l F d, Y, h:i A");
?>

Array:
An array stores multiple values in one single variable.

In PHP, there are three kind of arrays:
•   Numeric array - An array with a numeric index
$names = array("Akki","Jimmi","Joy");

•   Associative array - An array where each ID key is associated with a value
$families = array
("Griffin"=>array
( "sam"," dino", "john"),
"Jimmi"=>array
("Glenn" ),
"Brown"=>array
("Cmohan", "rajesh","machi"));

•   Multidimensional array - An array containing one or more arrays
                         $ages = array("sam"=>21, "dino"=>18, "john"=>20);