Spot my PHP 7 bug/warning
$10-30 USD
Pago na entrega
Line 21 and line 43 of this function cause a PHP 7.2 warning of : A non-numeric value encountered. Please rewrite these 2 lines to eliminate the warnings that are filling up my error_logs. ( It is the lines containing the operator & )
Don't post the answer. Bid $30. Post that you have solved it, be the first to say so.
function seedMT($seed,$min,$max) {
// The 624 element array used to get random numbers.
static $mt = array();
// The previous SEED.
static $previousSeed = null;
// The index used when selecting a number to randomize.
static $indexRand = 0;
// This Regenerate when reseeding or seeding initially
if ($seed !== null && $seed !== $previousSeed) {
$mt = array(&$seed, 624 => &$seed);
$previousSeed = $seed;
for ($i = 1; $i < 624; ++$i) {
$mt[$i] = (0x6c078965 * ($mt[$i - 1] ^ ($mt[$i - 1] >> 30)) + $i) & 0xffffffff;
}
}
// Every 624 numbers we regenerate
if ($indexRand == 0) {
// This has been tweaked for maximum speed and elegance
// Explanation of possibly confusing variables:
// $p = previous index
// $sp = split parts of array - the numbers at which to stop and continue on
// $n = number to iterate to - we loop up to 227 adding 397 after which we finish looping up to 624
// subtracting 227 to continue getting out 397 indices ahead reference
// $m = 397 or -227 to add to $i to keep our 397 index difference
// $i = the previous element in $sp, our starting index in this iteration
for ($j = 1, $sp = array(0, 227, 397); $j < count($sp); ++$j) {
for ($p = $j - 1, $i = $sp[$p], $m = ((624 - $sp[$j]) * ($p ? -1 : 1)), $n = ($sp[$j] + $sp[$p]); $i < $n; ++$i) {
$y = ($mt[$i] & 0x80000000) + ($mt[$i + 1] & 0x7fffffff);
$mt[$i] = $mt[$i + $m] ^ (($y & 0x1) * 0x9908b0df);
}
}
}
// This selects a number from the array and randomizes it.
$y = $mt[$indexRand];
$y ^= $y >> 11;
$y ^= ($y << 7) & 0x9d2c5680;
$y ^= ($y << 15) & 0xefc60000;
$y ^= $y >> 18;
// The index is incremented so we will be able to get a different random number without changing the seed.
$indexRand++;
if ($indexRand == 624) $indexRand = 0;
return $y % ($max - $min + 1) + $min;
}
ID do Projeto: #22271162
Sobre o projeto
Concedido a:
you must set type to num in min and max that will solve your erroryou must set type to num in min and max that will solve your erroryou must set type to num in min and max that will solve your error
6 freelancers estão ofertando em média $25 nesse trabalho
Hello! I am a web developer. I've read your job description with great interest. I've fully understood what you want and if you hire me, you would get the best result. I can start work immediately and can chat with yo Mais
Dear Client. Thanks for your job posting. My slogan is to satisfy the client's requirement with a low price. However, high quality and fast-deliver is promised. I am interested in your project. Because I have strong sk Mais