Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_mdtm() function in PHP
The ftp_mdtm() function returns the last modified time of a specified file in PHP.
Syntax
ftp_mdtm(con,file);
Parameters
con − The FTP connection
myfile − The file to check
Return
The ftp_mdtm() function returns the last modified time as a Unix timestamp.
Example
The following is an example −
<?php
$ftp_server="192.168.0.4";
$ftp_user="john";
$ftp_pass="tywg61gh";
$con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($con, $ftp_user, $ftp_pass);
$myfile = "new.txt";
// last modified time
$last_modified = ftp_mdtm($ftp_conn, $file);
if ($last_modified != -1){
echo "$myfile was last modified on " . date("F d Y H:i:s.",$last_modified);
} else {
echo "Cannot get last modified!";
}
ftp_close($con);
?>Advertisements