Jump to content

Checking if two arrays have the same values


timvdalen

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.