1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| <?php
function dirsize($dir) { @$dh = opendir($dir); $size = 0; while($file = @readdir($dh)) { if($file != "." and $file != "..") { $path = $dir . "/" . $file;
if(is_dir($path)) { $size += dirsize($path); } elseif(is_file($path)) { $size += filesize($path); } } }
@closedir($dh); return $size; } function add($a, $b) { return $a + $b; } $result = add(2, 3); echo "The result of 2 + 3 is: $result";
echo "<br>"; $result = call_user_func(add, 2, 3); echo "The result of 2 + 3 is: " . $result;
echo "<br>";
echo dirsize("./");
?>
|