-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo8.php
More file actions
81 lines (80 loc) · 2.69 KB
/
demo8.php
File metadata and controls
81 lines (80 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<html>
<body>
© 2010-
<?php
echo "the different between year is: "
.date("y")."<br>";
echo "today date is: ".date("d-m-y")."<br>";
echo "today date is: ".date("d.m.y")."<br>";
echo "today is ".date("l")."<br>";
echo "today date is: ".date("d/m/y")."<br>";
echo "<br>";
echo "<br>";
date_default_timezone_set("Asia/Calcutta");
echo "the time is ".date("h:i:sa")."<br>";
$a=mktime(9,54,56,9,25,2009);
echo date("d/m/Y h:i:sa",$a)."<br>";
$b=strtotime("10:20pm april 17 1999");
echo date("d/m/Y h:i:sa",$b)."<br>";
$c=strtotime("+1 year");
echo date("d/m/Y h:i:sa",$c)."<br>";
$d=strtotime("tomorrow");
echo date("d/m/Y h:i:sa", $d)."<br>";
$e=strtotime("yesterday ");
echo date("d/m/Y h:i:sa");
echo "<br>";
echo "<br>";
echo "<br>";
$startdate=strtotime("april");
$enddate=strtotime("+5 Year",$startdate);
while ($startdate<$enddate){
echo date(" d M Y ",$startdate)."<br>";
$startdate=strtotime("+1 year",$startdate);
}
echo "<br>";
echo "<br>";
$startdates=strtotime("+3 monday");
$enddates=strtotime("+1 month",$startdates);
while($startdates<$enddates){
echo "Shravan date is: ".date("M d l",$startdates)."<br>";
$startdates=strtotime("+1 week",$startdates);
}
echo "<br>";
echo "<br>";
echo "<h2>readfile function</h2>";
echo readfile("aa.txt");
echo "<br>";
echo "<br>";
echo "<h2>open/ read </h2>";
$myfile = fopen("aa.txt", "r") or die("Unable to open file!");
echo fread($myfile,filesize("aa.txt"));
fclose($myfile);
echo "<br>";
echo "<br>";
$myfile =fopen("aa.txt", "r") or die("Unable to open file!");
echo fgets($myfile)."<br>";
echo fgets($myfile)."<br>";
fclose($myfile);
echo "<br>";
echo "<br>";
$myfile = fopen("aa.txt", "r") or die("Unable to open file!");
// Output one line until end-of-file
while(!feof($myfile)) {
echo fgets($myfile) . "<br>";
}
fclose($myfile);
echo "<br>";
echo "<br>";
$myfile=fopen("aa1.txt", "w") or die("Unable to open file!");
$txt="Aakash Jaiswal\n";
fwrite($myfile, $txt);
fclose( $myfile);
echo "<br>";
$myfile=fopen("aa1.txt","a") or die ("Unable to open file!");
$txt="Aadarsh jaiswal\n";
fwrite($myfile,$txt);
fclose($myfile);
echo "<br>";
?>
</body>
</html>