In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Deirdre Mc Cann) wrote:

> for ($i = 0; $i<100; $i++){
>       $a[$i] = rand(0,9);
>       $test=$a[$i];
>       }
> 
> $ra = array_unique($test);
> 
> I keep getting an error saying $test is the incorrect type. Can someone 
> please explain why this doesn't work.

$test is a string variable, not an array.  To add elements to an array, 
either use $varname[], array_push(), or array_unshift().

BTW, when an error message says that a variable is not the right type, this 
is a good time to use gettype() and/or var_dump() in order to check that 
the variable really has the type and value(s) what that you expect.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to