Advertisement
OleKEH

Test numeric orders

Jul 27th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. // Test to see MarketPress order number generator generates numbers who is only digits.
  4. // Save in a file and run in terminal.
  5.  
  6. $count = 10000;
  7. $nums = 0;
  8. for ($i = 0; $i < $count; $i++) {
  9.     $order_id = substr( sha1( uniqid( '' ) ), rand( 1, 24 ), 12 );
  10.     if (is_numeric($order_id)) {
  11.         echo "\n".$order_id."\n";
  12.         $nums ++;
  13.     } else {
  14.         echo ".";
  15.     }
  16. }
  17. $pro = $nums * 100 / $count ;
  18. echo "\n $nums Order-ids numeric out of $count  =>  $pro %\n";
  19.  
  20. /*
  21.  
  22. Output (Last lines):
  23. 735794351019
  24. .....................................................
  25. 142417955337
  26. ..........................................................................
  27. 680235e21764
  28. .........................................
  29.  68 Order-ids numeric out of 10000 =>  0.68 %
  30.  
  31. */
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement