Hello! The error above appears on line 9 and i can't seem to figure it out!

<?php
		srand(time());
		for ($i=0; $i < 5; $i++)
		{
		$rand1 = (rand()%13 + 1);
		$rand2 = (rand()%4 + 1);
		$slot[$i] = $rand1*10 + $rand2;
		for($j=0;$j<$i;$j++)
		while(slot[$i] == slot[$j])
		{
		$rand1 = (rand()%13 + 1);
		$rand2 = (rand()%4 + 1);
		$slot[$i] = $rand1*10 + $rand2;
		}

		}
		?>

I went through it over and over again but I can't see what's wrong. Any help appreciated :)

Recommended Answers

All 3 Replies

Hey soultrav,

Not sure if this is a typo in your post, line 9 should read:

while($slot[$i] == $slot[$j])

You seem to be missing the $

yes, that was it :icon_redface:

it's embarassing, but that's a lesson for me, i should go to sleep now :)

thanks!

No need to be embarrassed, I do it all the time :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.