has some1 written a script to break a text file into multiple files. I have to check if the size of the text, if it greater than 4KB i need to split it into different file each not greater than 4KB
This does the trick. <?php $file = 'longtext.txt'; $content = file_get_contents($file); $chunks = 1; if (strlen($content) > 4096) { foreach (str_split($content, 4096) AS $chunk) { file_put_contents("chunk_{$chunks}.txt", $chunk); $chunks++; } } ?> PHP:
wat will i do without you, man!! yea, so finally this was my last day and last code as a coder. Thanks a lot nico, u saved my butt lot many times. c ya around