我有一個如下的對象數組;我如何過濾(刪除)具有admins-> member = 11的對象?如何從對象數組中過濾掉一個對象?
在這個例子中,結果數組對象只有第一個對象[245]在開始。
Array
(
[245] => stdClass Object
(
[name] => Programmation Web
[description] =>
[public] => 0
[jointype] => controlled
[grouptype] => course
[membershiptype] => member
[reason] =>
[role] => tutor
[ctime] => 2011-10-12 14:41:35
[mtime] => 0000-00-00 00:00:00
[image] =>
[session_id] => 28
[session_name] => Hiver 2012
[membercount] => 1
[favorite] =>
[requests] => 0
[id] => 245
[members] => Array
(
[0] => stdClass Object
(
[id] => 11
[name] => Yves Otis (otisyves)
)
)
[projects] => Array
(
[0] => stdClass Object
(
[id] => 1923
[title] => Sans titre (1)
[description] =>
[owner] => 11
[ownerformat] =>
[group] =>
[institution] =>
[startdate] =>
[stopdate] =>
[ctime] => 2011-10-12 13:24:26
[mtime] => 2011-10-12 13:24:26
[atime] => 2011-10-12 13:24:26
[submittedgroup] => 245
[submittedhost] =>
[submittedtime] => 2011-10-12 17:00:41
[numcolumns] => 3
[layout] =>
[theme] =>
[template] => 0
[copynewuser] => 0
[type] => portfolio
[visits] => 0
[allowcomments] => 1
[approvecomments] => 0
[skills] =>
[instructions] =>
[accessconf] =>
[image] =>
[competencesvisees] =>
[consignes] =>
[fichierconsignes] =>
[groupevise] =>
)
)
[project_count] => 1
[admins] => Array
(
[0] => stdClass Object
(
[member] => 11
[firstname] => Yves
[lastname] => Otis
)
)
[topic_name] => Le PHP
[activites] => Array
(
[0] => stdClass Object
(
[topic_name] =>
[topic_id] => 42
[post_parent] => 107
[post_body] => Oui moi aussi je me demande ça.
[post_id] => 109
)
)
[forums] => Array
(
[0] => stdClass Object
(
[forum_name] => Discussion générale
[forum_id] => 101
)
)
)
[246] => stdClass Object
(
[name] => Les bases de données
[description] =>
[public] => 0
[jointype] => controlled
[grouptype] => course
[membershiptype] => admin
[reason] =>
[role] => admin
[ctime] => 2011-10-13 15:27:30
[mtime] => 0000-00-00 00:00:00
[image] =>
[session_id] => 27
[session_name] => Automne 2011
[membercount] => 0
[favorite] =>
[requests] => 0
[id] => 246
[project_count] => 0
[topic_name] => Difficulté
[activites] => Array
(
[0] => stdClass Object
(
[topic_name] =>
[topic_id] => 44
[post_parent] => 111
[post_body] => Ouah!
[post_id] => 112
)
)
[forums] => Array
(
[0] => stdClass Object
(
[forum_name] => Le MySQL
[forum_id] => 103
)
)
)
)
我想檢查對指數
重複http://stackoverflow.com/questions/7826358/how-to -filter-an-array-of-object – SparrowG