Following example shows that use of an array to sort records in ascending and descending order using PHP program.
Out put of the above program is... (function sort() to use display records in ascending and function rsort() to display in descending order.)
PHP Program to compress the data / text.
Output of the above program is...
PHP Program to display server date and time.
[m=month, d=day, y=year, h=hours, i=minutes, s=seconds and A=ante meridiem] Output of the above program is...
Cookies and session programs on php...
<?php
$arr = array('Apple', 'Zensor', 'MITIndia');
echo "<br><b>Without sorted values are..</b><br>";
echo $arr[0], "<br>";
echo $arr[1], "<br>";
echo $arr[2], "<br>";
echo "<br><b>Sorted values are..</b><br>";
sort($arr);
$len=count($arr);
for($i=0; $i<$len; $i++)
{
echo $arr[$i], "<br>";
}
echo "<br><b>Reverse sorted values are..</b><br>";
rsort($arr);
$len=count($arr);
for($i=0; $i<$len; $i++)
{
echo $arr[$i], "<br>";
}
?>
Out put of the above program is... (function sort() to use display records in ascending and function rsort() to display in descending order.)
<?php
echo "<h1> Compress character with PHP </h1>";
echo "<hr>";
$str="Hello World Hello WorldHello WorldHello WorldHello
WorldHello WorldHello WorldHello WorldHello WorldHello
WorldHello WorldHello WorldHello WorldHello WorldHello
WorldHello WorldHello WorldHello WorldHello WorldHello
WorldHello WorldHello WorldHello World";
$compressed = gzcompress($str);
echo "Original file length: ". strlen($str)."\n";
echo "Compressed size: ". strlen($compressed)."\n";
?>
Output of the above program is...
PHP Program to display server date and time.
<?php
echo "Today date :", date("m/d/y");
echo "<br>The time is " . date("h:i:sA");
echo "<br>";
echo date('d-m-Y H:i');
echo "<br>";
?>
[m=month, d=day, y=year, h=hours, i=minutes, s=seconds and A=ante meridiem] Output of the above program is...
Cookies and session programs on php...
No comments:
Post a Comment