What are common functions used in PHP to retrieve file information such as modification date and size?
To retrieve file information such as modification date and size in PHP, you can use the `filemtime()` function to get the modification date and `filesize()` function to get the size of the file. These functions can be helpful when you need to display file information on a webpage or perform operations based on file attributes.
$file = 'example.txt';
$modification_date = filemtime($file);
$file_size = filesize($file);
echo "File Modification Date: " . date("Y-m-d H:i:s", $modification_date) . "<br>";
echo "File Size: " . $file_size . " bytes";
Related Questions
- What are common mistakes to avoid when trying to delete data from a table using PHP and MySQL?
- In what scenarios would it be more beneficial to use file_get_contents() or fopen() instead of include() in PHP development?
- Why is it important to hash passwords before storing them in a database, and how can password hashing be implemented in PHP?