On Sat, 2006-04-22 at 07:09, suresh kumar wrote: > sorry.earlier i mistyped some values. > > I am facing one project in my project . > > this is my code: > > a=array(0=>10,1=>10,2=>40,3=>30,4=>30,5=>10); > b=array(); > b=array_unique($a); > print_r($b); > o/p getting from above code is b[0]=10,b[2]=40,b[3]=30,b[5]=10; > > but i want the o/p be b[0]=10,b[1]=40,b[2]=30,b[3]=10; That will return: Array ( [0] => 10 [2] => 40 [3] => 30 ) If you want: Array ( [0] => 10 [1] => 40 [2] => 30 ) Don't use an associative array for $a $a=array(10,10,40,30,30,10); Or iterate through $a to re-sequence the index in $b. $a=array(0=>10,1=>10,2=>40,3=>30,4=>30,5=>10); $a=array_unique($a); foreach($a as $v) { $b[] = $v; } print_r($b); -- s/:-[(/]/:-)/g Brian GnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu ====================================================================== gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC Key Info: http://gfx-design.com/keys Linux Registered User #339825 at http://counter.li.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php