I am fairly new to PHP in general having only used it a litttle bit over the last few years since 3.x. However I have started to try and work on a little system that will allow me to monitor hard drive usage and so on via a web page.
I have written the following code.
<?
$limit = "80";
$filename = "/home/james/public_html/hdspace/hda1.results";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
print("<BODY>\n");
function foo($arg) {
if ($arg >= $limit) {
print(" the drive space is more than 80 \n");
} else {
print(" the drive space is less than 80 \n");
}
}
foo($contents);
print("<BR>");
print("this is the threshold of the drive space \n");
print($limit);
print("<BR>\n");
print("This is ARG for the Function input \n");
print($contents);
print("<BR>\n");
print("</BODY>\n");
?>
When I use the above php code with the $contents as 17 and the $limit as 80 it says it says that the space is more than 80 when it shouldnt be.
When I change the number 17 to 88 it doesnt change the output,
Why is this happening...
Thankyou in advance
James