GenLongString


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

Requirements



Tested on Linux.

The script (version 1.0.0)


genlongstring.php (line 1)
  1. #!/usr/bin/php -q
  2. <?php
  3.  
  4. /*
  5.         GenLongString - generate a string of a given length
  6.         Copyright (C) 2016 Ɓukasz "Cyber Killer" Korpalski
  7.  
  8.         This program is free software: you can redistribute it and/or modify
  9.         it under the terms of the GNU General Public License as published by
  10.         the Free Software Foundation, either version 3 of the License, or
  11.         (at your option) any later version.
  12.  
  13.         This program is distributed in the hope that it will be useful,
  14.         but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.         GNU General Public License for more details.
  17.  
  18.         You should have received a copy of the GNU General Public License
  19.         along with this program.  If not, see <http://www.gnu.org/licenses/>.
  20. */
  21.  
  22. if($_SERVER["argc"]==2 && preg_match('/^\d+$/',$_SERVER["argv"][1])==1)
  23. {
  24.         for($i=1;$i<=$_SERVER["argv"][1];$i++)
  25.         {
  26.                 if($i%1000000==0) print('m');
  27.                 elseif($i%1000==0) print('k');
  28.                 elseif($i%100==0) print('h');
  29.                 elseif($i%10==0) print('d');
  30.                 else print('s');
  31.         }
  32. }
  33. else
  34. {
  35.         print('Syntax error');
  36. }
  37. print("\n");
  38.  
  39. ?>


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 GNU GPL v3 or later.


CategoryProjekty

There are no comments on this page. [Add comment]

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