|
General Details
|
|
PHP (Hypertext Preprocess...
|
|
Posted 1.99 Year Ago
|
|
324 Views
|
|
Received 3 Ratings
|
|
PHP Blank FIle Creator
Description
Ever wanted to piss off your friends by sending them a huge file, only for them to find out its empty? Probably not. Here's one anyway.
Technical
To use, just run it like this: script.php?size=5
(Where 5 is however many gigabytes you want the file to be)
Source Code
Comments
| Please login to post comments. |
|
|
You may want to add:
set_time_limit(0);
at the very top to prevent the script dying after the max execution time.
Also you could do this to create the huge file:
$chars = '';
while (strlen($chars) < $size) {
$chars .= 'dhdjshkahdsjahdjaskhdjsahdjshdsdhsjhdasjdhasjhsjhsjjdjdjshjdhasjhdasjdhasj' ;;
}
file_put_contents('file.txt'); //PHP 5 only
Haven't tested it... but something like that :-)
and adding 1 character at a time would be much slower than adding many at a time... since PHP will have to keep adjusting the memory slot of the variable by 1 every time and it would also mean a lot more iterations to reach the desired file size (especially since its in GB!)
Kind regards,
Scott
|
More "PHP (Hypertext Preprocessor)" Source Codes By This Author
Recently Posted "PHP (Hypertext Preprocessor)" Source Codes
Recently Rated "PHP (Hypertext Preprocessor)" Source Codes
|