Current location: Hot Scripts Forums » Programming Languages » PHP » Search 2 similar value


Search 2 similar value

Reply
  #1 (permalink)  
Old 01-25-05, 09:33 PM
eddyvlad eddyvlad is offline
Wannabe Coder
 
Join Date: Sep 2003
Location: In The Bloody Pits Of Hell
Posts: 160
Thanks: 2
Thanked 0 Times in 0 Posts
Search 2 similar value

How do I search for 2 similar value in an array and combine them....

PHP Code:

// From this....
Array
        (
            [
1] => Barry
            
[2] => Chris
            
[3] => Fish
            
[4] => Fish
            
[5] => Fish
            
[6] => Yeah
        
)
 
// To this...
Array
        (
            [
1] => Barry
            
[2] => Chris
            
[3] => Fish
            
[4] => Yeah
        

__________________
Mr. Brown Eyes
Reply With Quote
  #2 (permalink)  
Old 01-25-05, 11:17 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by eddyvlad
How do I search for 2 similar value in an array and combine them....

PHP Code:

// From this....

Array
        (
            [
1] => Barry
            
[2] => Chris
            
[3] => Fish
            
[4] => Fish
            
[5] => Fish
            
[6] => Yeah
        
)
 
// To this...
Array
        (
            [
1] => Barry
            
[2] => Chris
            
[3] => Fish
            
[4] => Yeah
        

Use 'array_unique' to do this. See http://us3.php.net/function.array-unique
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #3 (permalink)  
Old 01-26-05, 02:22 AM
eddyvlad eddyvlad is offline
Wannabe Coder
 
Join Date: Sep 2003
Location: In The Bloody Pits Of Hell
Posts: 160
Thanks: 2
Thanked 0 Times in 0 Posts
Hmm.... it's what I want but....
I want to know which keys are afffected. Coz I need to sync with another array.
__________________
Mr. Brown Eyes
Reply With Quote
  #4 (permalink)  
Old 01-26-05, 05:57 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
remember that array_unique() returns a new array after it's been processed!
so the original array still exists and you can do some comparsion to know which are the affected ones
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #5 (permalink)  
Old 01-26-05, 06:00 AM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
the key is always about creativity..
__________________
just an ignorant noob with moronic solution...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SEO Expert Available nakulgoyal Job Offers & Assistance 2 08-14-04 12:38 PM
IonPanel or similar script search LilyDollGirl PHP 1 07-30-04 10:06 PM
Simple search script niceguyonline Script Requests 3 03-07-04 11:09 PM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 05:28 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.