Hi, I have a script here downloaded from the net. It works fine, I'm just not quite clear how it works.
function save_file($filename, $contents) {
    $i = 0;
    do {
        $handle = fopen($filename, "w+");
        $fout = fwrite($handle, $contents);
    } while(filesize($filename) < 5 && $i < 5);
Can someone please explain the while() part? Why does it need a loop to save files? and what is the $i for?

any information would be greatly appreciated.