Skip to content

Instantly share code, notes, and snippets.

@jmikola
Created July 28, 2010 22:36
Show Gist options
  • Save jmikola/496578 to your computer and use it in GitHub Desktop.
Save jmikola/496578 to your computer and use it in GitHub Desktop.
Add a random number of tabs to random lines in a string
<?php
function fitzify ($input) {
return implode(\PHP_EOL, array_map(function($line) {
return $line . (rand(1, 4) == 1 ? str_repeat("\t", rand(1, 4)) : '');
}, explode(\PHP_EOL, $input)));
}
$a = file_get_contents(__FILE__);
echo fitzify($a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment