Đã hoàn thành

Spot my PHP 7 bug/warning

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;

}

Kĩ năng: PHP

Xem nhiều hơn: easy php login bug fix, fixing forbidden php board bug, fix include php injection bug, php form bug, php proxy bug, paypal php check bug, php code curl command line, php read email subject line, cre loaded warning line, heat map hot spot php, flash php open image draw line, php script bug fixes, exec php plugin bug mod_security, hot spot php script, opensource php mysql bug tracker, php code bug, php programmer bug fixing, php script adult warning, php adult site warning, php 7.3 bug

Về Bên Thuê:
( 175 nhận xét ) Edmonton, Canada

ID dự án: #22271162

Được trao cho:

amjadali4888

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

$30 USD trong 7 ngày
(70 Đánh Giá)
5.2
eliaa

Hello, I have gone through your requirements and understand what you need. I am a Web developer with 7 years experience I have used a lot of technology to implement my clients solutions. List of Services that i can hel Thêm

$30 USD trong 1 ngày
(16 Đánh Giá)
4.2

9 freelancer đang chào giá trung bình $29 cho công việc này

dreammate0621

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 Thêm

$20 USD trong 7 ngày
(23 Nhận xét)
5.6
AiAge888

⭐⭐⭐Hello. I have read your requirement carefully. I am a professional ⭐ PHP & JavaScript expert ⭐with a rich experience that makes many sites with mainly Codeigniter,Laravel,Yii,MySQL,MongoDB for 7+years. Also I h Thêm

$50 USD trong 2 ngày
(10 Nhận xét)
4.1
vaibhavAP

5 years experience in Reactjs / Redux / Angular / Nodejs / PHP / Django / Backned - Frontend development! All of our programming skills: *Front-end: - HTML, HTML5, JSON. - JAVASCRIPT (Ajax, AngularJS / 2 / 4 / 5 / Thêm

$30 USD trong 1 ngày
(15 Nhận xét)
4.0
MaLiguo

Hi. I have interested in your job. Especially i have talent in Web. Please contact for further discussion. Thank you.

$30 USD trong 1 ngày
(5 Nhận xét)
3.4
HexamazeTech

Greetings from Hexamaze Technologies! We went through the project regarding your requirements. We understood the requirements and your expectations. We are a Web and Mobile App development team from India and work wo Thêm

$17 USD trong 1 ngày
(10 Nhận xét)
2.7
wolfman199311

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 Thêm

$20 USD trong 7 ngày
(1 Nhận xét)
2.0
ShenAizhen

⭐⭐⭐⭐⭐ Greetings Dear Client! ⭐⭐⭐⭐⭐ Professional Php developer is ready for your project! I have gone through your description and I'm very interesting as an expert in this field. I'm developing Php for 7+ years and hav Thêm

$30 USD trong 1 ngày
(1 Nhận xét)
1.2