DWPD : Practical 15
index.php file code<?php
echo "<h3>Date/Time functions</h3><br>";
echo date("d/m/y")."<br/>";
echo date("d M,Y")."<br/>";
$date_array = getdate();
foreach ( $date_array as $key => $val )
{
print "$key = $val<br />";
}
echo var_dump(checkdate(2,29,2003))."<br>";
echo var_dump(checkdate(2,29,2004))."<br>";
echo time();
echo(date("M-d-Y",mktime(0,0,0,12,36,2001))."<br>");
echo(date("M-d-Y",mktime(0,0,0,1,1,99))."<br>");
$formated_date = "Today's date: ";
$formated_date .= $date_array['mday'] . "/";
$formated_date .=
$date_array['mon'] . "/";
$formated_date .= $date_array['year'];
print $formated_date;
print date("m/d/y G.i:s<br>", time());
print "Today is ";
print date("j of F Y, \a\\t g.i a", time());
echo "<br><h3>Math functions</h3>";
echo abs(6.7)."<br>";
echo abs(-6.7)."<br>";
echo abs(-3)."<br>";
echo abs(3);
echo ceil(0.60)."<br>";
echo ceil(0.40)."<br>";
echo ceil(5)."<br>";
echo ceil(5.1)."<br>";
echo ceil(-5.1)."<br>";
echo ceil(-5.9);
echo exp(0)."<br>";
echo exp(1)."<br>";
echo exp(10)."<br>";
echo exp(4.8);
echo floor(0.60)."<br>";
echo floor(0.40)."<br>";
echo floor(5)."<br>";
echo floor(5.1)."<br>";
echo floor(-5.1)."<br>";
echo floor(-5.9)."<br>";
echo rand(10,100)."<br>";
echo min(2,4,6,8,10)."<br>";
echo max(2,4,6,8,10)."<br>";
echo pow(2,4)."<br>";
echo round(0.60)."<br>";
?>
Output :
Comments
Post a Comment