0

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 :)

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by jt1
0

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 $

0

yes, that was it :icon_redface:

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

thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.