If what you want is to have a continuos secuential array (i.e. 0=>x,
1=>a, 2=>f) and there's no need for sorting the values, then you need
array_values()[1]
[1] http://php.net/array-values
suresh kumar wrote:
I am facing one project in my project .
this is my code:
a=array(0=>10,
and more practically your code get corrected to this:
for ($i = 0; $i<100; $i++)
{
$a[$i] = rand(0,9);
$test[]=$a[$i];
}
$ra = array_unique($test);
and your code get optimized to this: (mostly of the manual!;))
$numbers = range (0,9);
srand ((double)microtime()*100);
shuffle ($numbe
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
3 matches
Mail list logo