|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-02-07 07:41 UTC] nikic@php.net
[2013-02-07 07:41 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 16:00:01 2025 UTC |
Description: ------------ Variable is properly set but returns as NULL value Test script: --------------- <?php function mtrand_except($min, $max, $except) { $random_number = mt_rand($min, $max); if(!in_array($random_number, $except)) { echo $random_number.'<br />'; return $random_number; } mtrand_except($min, $max, $except); } $random_arr = array(); for($i=1; $i<=90; $i++) { $rand = mtrand_except(1, 90, $random_arr); echo $i.'<br />'.$rand.'<hr />'; $random_arr[] = $rand; } Expected result: ---------------- 60 1 60 ------ 19 2 19 ------ 57 3 57 ------ etc... Actual result: -------------- 60 1 60 ------ 19 2 NULL ------ 57 3 57 ------ etc...