স্পর্শ() ফাংশন একটি ফাইলের অ্যাক্সেস এবং পরিবর্তনের সময় সেট করে। এটি সাফল্যের ক্ষেত্রে সত্য বা ব্যর্থতার ক্ষেত্রে মিথ্যা ফেরত দেয়।
সিনট্যাক্স
touch(filename, time, atime)
পরামিতি
-
ফাইলের নাম − ফাইলের নাম সেট করুন।
-
সময় - সময় নির্ধারণ করুন। ডিফল্ট বর্তমান সিস্টেম সময়।
-
একসময় - অ্যাক্সেসের সময় সেট করুন। ডিফল্ট বর্তমান সিস্টেম সময়।
ফেরত
স্পর্শ() ফাংশন সফল হলে সত্য, অথবা ব্যর্থতার ক্ষেত্রে মিথ্যা প্রদান করে।
উদাহরণ
<?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.