Уважаемый, а Вы задачу вообще читали? /ru/forum/77169
Ну для тех, кто до сих пор на 4, очень примитивная версия спасательного круга:
if ( !function_exists('file_put_contents') ) { function file_put_contents($filename, $contents) { $f=@fopen($filename, 'w'); if ( !$f ) { return false; } else { fwrite($f, $contents); fclose($f); } } }
К чему городить такой огород? Задача решается элементарно в три строки:
$lines = file('in.txt'); shuffle($lines); file_put_contents('out.txt', implode('', $lines));
А плиз, ткните пальцем, где написано про макс. кол-во блоков - 3? Читаю https://google.com/adsense/terms, и в упор не вижу ничего, кроме:
"You agree that while You may display more than one (1) Ad Unit on each Site Web page, You shall not display any Ad Unit on a page that contains Ads associated with another Google AdSense customer (e.g., Your Web hosting company), unless authorized to do so by Google.".
Или я не там читаю?