Q:

Write a PHP program to get the size of a file

0

Write a PHP program to get the size of a file.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$myfile = fopen("/home/students/ppp.txt", "w") or die("Unable to open file!");
$txt = "PHP Exercises\n";
fwrite($myfile, $txt);
$txt = "from\n";
fwrite($myfile, $txt);
$txt = "w3resource\n";
fwrite($myfile, $txt);
fclose($myfile);
echo "Size of the file: ".filesize("/home/students/ppp.txt")."\n";
?>

Sample Output:

Size of the file: 30

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now