All pastes #2052356 Raw Edit

WINNING in php

public text v1 · immutable
#2052356 ·published 2011-04-30 21:19 UTC
rendered paste body
<?php
// Open our file we are going to blank.
$fp=fopen('FILENAME.txt', 'wb');
// Let's ge tthe filesize of the file we are going to blank.
$fs=filesize('FILENAME.txt');
$dataWritten=0;
// Loop through writing to the file in chunks of 1024 bytees.
while ($i<=$fs)
{
	// Write 1024 bytes to the file.
	if (fwrite($fp, str_repeat(0, 1024)) === FALSE) {
		// FOllowing is completely unnesscary.
		if (rand(0,1) == 0)
		{
			echo '-';
		}
		else
		{
			echo '+';
		}
	}
	else
	{
		// We are done writing.
		echo ' Done';
	}

	// Keep count of how much data we have written.
	$i=$i+1024;
}
fclose($fp);
?>