timvdalen Posted July 16, 2010 Share Posted July 16, 2010 Hi I'm trying to come up with 5 values that don't occur in a certain array. So far, I came up with this: $newqs = array(rand(0,45),rand(0,45),rand(0,45),rand(0,45),rand(0,45)); while($okay == false){ for($i=0; $i=4; $i++){ foreach($questions as $qasked){ if($newqs[$i] == $qasked){ $newqs[$i]++; $okay == false; }else{ $okay == true; } } } } But, that has like a huge execution time. Is there any way to do this in an instant. Tim Link to comment https://forums.phpfreaks.com/topic/207919-checking-if-two-arrays-have-the-same-values/ Share on other sites More sharing options...
timvdalen Posted July 16, 2010 Author Share Posted July 16, 2010 Ah, I found a way with in_array() Link to comment https://forums.phpfreaks.com/topic/207919-checking-if-two-arrays-have-the-same-values/#findComment-1086961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.