स्पर्श () फ़ंक्शन फ़ाइल की पहुंच और संशोधन समय निर्धारित करता है। यह सफलता पर TRUE देता है, या विफलता पर FALSE देता है।
सिंटैक्स
touch(filename, time, atime)
पैरामीटर
-
फ़ाइल नाम - फ़ाइल का नाम सेट करें।
-
समय - समय निर्धारित करें। डिफ़ॉल्ट वर्तमान सिस्टम समय है।
-
समय - पहुंच का समय निर्धारित करें। डिफ़ॉल्ट वर्तमान सिस्टम समय है।
वापसी
स्पर्श () फ़ंक्शन सफलता पर TRUE, या विफलता पर FALSE लौटाता है।
उदाहरण
<?php
$myfile = "new.txt";
// changing the modification time to current system time
if (touch($myfile)) {
echo ("The modification time of $myfile set to current time.");
} else {
echo ("The modification time of $myfile can’t be updated.");
}
?> आउटपुट
The modification time of new.txt set to current time.
आइए एक और उदाहरण देखें।
उदाहरण
<?php
$myfile = "new.txt";
$set_time = time() - 28800;
// changing the modification time
if (touch($myfile, $set_time)) {
echo ("The modification time of $myfile updated to 8 hrs in the past.");
} else {
echo ("The modification time of $myfile can’t be updated.");
}
?> आउटपुट
The modification time of new.txt updated to 8 hrs in the past.