PC Nerd Posted April 4, 2007 Share Posted April 4, 2007 i have the followng code and its not setting the correct values to the variable $var1 = rand(1, 3); $var2 = rand(1, 4); this doesnt save the renaodm numbers, but it does create the variabl i know i havent reassinge the variable contence anywhere, so ts stayed the same i know this becauase i go if (empty($var1)) {echo "var1 is EMPTY!!!!!";} and the same with var 2 so is this the right way to asigne random numbers, becauase its worked in other parts of the site. thanks Link to comment https://forums.phpfreaks.com/topic/45516-solved-not-asigning-the-random-number/ Share on other sites More sharing options...
joquius Posted April 4, 2007 Share Posted April 4, 2007 there's no reason this shouldn't work, perhaps you set them inside/outside a function and haven't set them as globals? Can you send more of the code? Link to comment https://forums.phpfreaks.com/topic/45516-solved-not-asigning-the-random-number/#findComment-220991 Share on other sites More sharing options...
jitesh Posted April 4, 2007 Share Posted April 4, 2007 place whole code Link to comment https://forums.phpfreaks.com/topic/45516-solved-not-asigning-the-random-number/#findComment-220994 Share on other sites More sharing options...
PC Nerd Posted April 4, 2007 Author Share Posted April 4, 2007 you were right thats the problem, it was defined inside a function, without returning the value thanks for your help Link to comment https://forums.phpfreaks.com/topic/45516-solved-not-asigning-the-random-number/#findComment-221004 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.