$file = "example.txt"; $fileSize = filesize($file); echo "The size of $file is: $fileSize bytes.";
$dir = "/path/to/directory"; $files = scandir($dir); foreach($files as $file) { if(is_file($dir . "/" . $file)) { echo "$file has a size of " . filesize($dir . "/" . $file) . " bytesThis example is finding all the files in a directory and getting their sizes. The scandir() function is used to get all the files in a directory. Then, we loop through each file and check if it is a file using the is_file() function. If it is a file, we print its name and size using the filesize() method. It is difficult to determine the exact package library used for this method as there are several filesystem packages available in PHP. However, based on the naming convention and usage, it is most likely part of the "oc" namespace, which could belong to a specific library or framework.
"; } }