Skip to content

Instantly share code, notes, and snippets.

@laruence
Created January 15, 2018 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laruence/fd0d443d2c5bacca9d8ab99250499956 to your computer and use it in GitHub Desktop.
Save laruence/fd0d443d2c5bacca9d8ab99250499956 to your computer and use it in GitHub Desktop.
<?php
$retry = 10;
$start = microtime(true);
while (--$retry) {
$length = (int)(300/$retry);
$str = file_get_contents("/dev/urandom", false, NULL, 0, $length);
//echo "String lenght: ", $length, "\n";
$time = microtime(true);
for ($i = 0; $i < 1000000; $i++) {
addslashes($str);
}
$time = microtime(true) - $time;
//echo "Used time: ", $time , "s", "\n";
}
echo "Total used time: ", microtime(true) - $start, "s\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment