Hello all, I have an array of objects that I need to remove some items and keep others. Here is my problem, I have this array::
I need to match these keys up
and find the best match by largest number on this key
If my array is called meAr here is how the matches will look
Code:
array
0 =>
object(stdClass)[9]
public 'id' => string '781' (length=3)
public 'root' => string '781' (length=3)
public 'RSS_Role' => string '6' (length=1)
public 'item' => string 'Bike' (length=4)
public 'RES_TYPE' => string 'cbstree' (length=7)
1 =>
object(stdClass)[11]
public 'id' => string '782' (length=3)
public 'root' => string '781' (length=3)
public 'RSS_Role' => string '6' (length=1)
public 'item' => string 'happy' (length=4)
public 'RES_TYPE' => string 'cbstree' (length=7)
2 =>
object(stdClass)[8]
public 'res_resource' => string '516' (length=3)
public 'groupname' => string '359' (length=3)
public 'id' => string '781' (length=3)
public 'item' => string 'Girl' (length=4)
public 'RSS_ROLE' => string '6' (length=1)
3 =>
object(stdClass)[15]
public 'id' => string '782' (length=3)
public 'root' => string '781' (length=3)
public 'RSS_Role' => string '6' (length=1)
public 'item' => string 'tony' (length=4)
public 'RES_TYPE' => string 'cbstree' (length=7)
4 =>
object(stdClass)
public 'res_resource' => string '225' (length=3)
public 'groupname' => string '55' (length=3)
public 'id' => string '781' (length=3)
public 'item' => string 'Ouch' (length=4)
public 'RSS_ROLE' => string '1' (length=1)
5 =>
object(stdClass)
public 'id' => string '782' (length=3)
public 'root' => string '781' (length=3)
public 'RSS_Role' => string '3' (length=1)
public 'item' => string 'DoomsDay' (length=4)
public 'RES_TYPE' => string 'cbstree' (length=7)
Code:
id
root
RES_TYPE
Code:
RSS_ROLE
If my array is called meAr here is how the matches will look
Code:
if(meAr[0]->id == meAr[1]->id &&
meAr[0]->root == meAr[1]->root &&
meAr[0]->RES_TYPE == meAr[1]->RES_TYPE ){
if(meAr[0]->RSS_ROLE > meAr[1]->RSS_ROLE){
"REMOVE meAr[1]"
}
if(meAr[0]->RSS_ROLE < meAr[1]->RSS_ROLE){
"REMOVE meAr[0]"
}
if(meAr[0]->RSS_ROLE == meAr[1]->RSS_ROLE){
"REMOVE meAr[0]"
}
}
[code]
I need to remove any duplicates and keep the objects that RSS_ROLE is the greatest. How can I do this, I am killing myself.
thanks,
timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
Congratulations!