Formatting code for GenLongString


show source only

======GenLongString======

This script geneatares a string of letters of a given lengh. Useful for e.g. testing software.

====Requirements====

~-php5-cli

Tested on Linux.

====The script (version 1.0.0)====

%%(php;1;genlongstring.php)
#!/usr/bin/php -q
<?php

/*
GenLongString - generate a string of a given length
Copyright (C) 2016 Ɓukasz "Cyber Killer" Korpalski

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

if($_SERVER["argc"]==2 && preg_match('/^\d+$/',$_SERVER["argv"][1])==1)
{
for($i=1;$i<=$_SERVER["argv"][1];$i++)
{
if($i%1000000==0) print('m');
elseif($i%1000==0) print('k');
elseif($i%100==0) print('h');
elseif($i%10==0) print('d');
else print('s');
}
}
else
{
print('Syntax error');
}
print("\n");

?>
%%

Just click grab to save the file, or copy&paste it yourself to your favorite editor. Remember to add executable permissions.

====License====

This program is under the [[http://www.gnu.org/licenses/gpl.html GNU GPL v3]] or later.

----
CategoryProjekty
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki