pust - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of pust.php

  1. <?php
  2.  
  3. $errors_len = 0;
  4. $errors_col = 0;
  5. $array = [];
  6.  
  7. for ($x = 1; $x <= 100000; $x++) {
  8.   $num = substr(hexdec(substr(hash("md5", substr(md5("test"), 0, 20) . random_bytes(mt_rand(1, 50))), 0, 10)), 0, 10);
  9.   
  10.   if (strlen($num) != 10) {
  11.       $errors_len += 1;
  12.   }
  13.   
  14.   if (in_array($num, $array)) {
  15.       $errors_col += 1;
  16.   }
  17.   
  18.   $array[] = $num;
  19.   
  20.   //echo "<p>" . strlen($num) . " - $num</p>";
  21. }
  22.  
  23. echo "<p>err.len: $errors_len</p>";
  24. echo "<p>err.col: $errors_col</p>";
  25.  
File Description
  • pust
  • PHP Code
  • 15 Aug-2019
  • 478 Bytes
You can Share it:
Related Tools