Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to filter out an object from an array of objects?
    text
    copied!<p>I've got an array of objects as follows ; how can I filter out (remove) the objects that have admins->member = 11 ?</p> <p>In this example, the resulting array object would only have the 1st object that [245] at the start.</p> <pre><code>Array ( [245] =&gt; stdClass Object ( [name] =&gt; Programmation Web [description] =&gt; [public] =&gt; 0 [jointype] =&gt; controlled [grouptype] =&gt; course [membershiptype] =&gt; member [reason] =&gt; [role] =&gt; tutor [ctime] =&gt; 2011-10-12 14:41:35 [mtime] =&gt; 0000-00-00 00:00:00 [image] =&gt; [session_id] =&gt; 28 [session_name] =&gt; Hiver 2012 [membercount] =&gt; 1 [favorite] =&gt; [requests] =&gt; 0 [id] =&gt; 245 [members] =&gt; Array ( [0] =&gt; stdClass Object ( [id] =&gt; 11 [name] =&gt; Yves Otis (otisyves) ) ) [projects] =&gt; Array ( [0] =&gt; stdClass Object ( [id] =&gt; 1923 [title] =&gt; Sans titre (1) [description] =&gt; [owner] =&gt; 11 [ownerformat] =&gt; [group] =&gt; [institution] =&gt; [startdate] =&gt; [stopdate] =&gt; [ctime] =&gt; 2011-10-12 13:24:26 [mtime] =&gt; 2011-10-12 13:24:26 [atime] =&gt; 2011-10-12 13:24:26 [submittedgroup] =&gt; 245 [submittedhost] =&gt; [submittedtime] =&gt; 2011-10-12 17:00:41 [numcolumns] =&gt; 3 [layout] =&gt; [theme] =&gt; [template] =&gt; 0 [copynewuser] =&gt; 0 [type] =&gt; portfolio [visits] =&gt; 0 [allowcomments] =&gt; 1 [approvecomments] =&gt; 0 [skills] =&gt; [instructions] =&gt; [accessconf] =&gt; [image] =&gt; [competencesvisees] =&gt; [consignes] =&gt; [fichierconsignes] =&gt; [groupevise] =&gt; ) ) [project_count] =&gt; 1 [admins] =&gt; Array ( [0] =&gt; stdClass Object ( [member] =&gt; 11 [firstname] =&gt; Yves [lastname] =&gt; Otis ) ) [topic_name] =&gt; Le PHP [activites] =&gt; Array ( [0] =&gt; stdClass Object ( [topic_name] =&gt; [topic_id] =&gt; 42 [post_parent] =&gt; 107 [post_body] =&gt; Oui moi aussi je me demande ça. [post_id] =&gt; 109 ) ) [forums] =&gt; Array ( [0] =&gt; stdClass Object ( [forum_name] =&gt; Discussion générale [forum_id] =&gt; 101 ) ) ) [246] =&gt; stdClass Object ( [name] =&gt; Les bases de données [description] =&gt; [public] =&gt; 0 [jointype] =&gt; controlled [grouptype] =&gt; course [membershiptype] =&gt; admin [reason] =&gt; [role] =&gt; admin [ctime] =&gt; 2011-10-13 15:27:30 [mtime] =&gt; 0000-00-00 00:00:00 [image] =&gt; [session_id] =&gt; 27 [session_name] =&gt; Automne 2011 [membercount] =&gt; 0 [favorite] =&gt; [requests] =&gt; 0 [id] =&gt; 246 [project_count] =&gt; 0 [topic_name] =&gt; Difficulté [activites] =&gt; Array ( [0] =&gt; stdClass Object ( [topic_name] =&gt; [topic_id] =&gt; 44 [post_parent] =&gt; 111 [post_body] =&gt; Ouah! [post_id] =&gt; 112 ) ) [forums] =&gt; Array ( [0] =&gt; stdClass Object ( [forum_name] =&gt; Le MySQL [forum_id] =&gt; 103 ) ) ) ) </code></pre> <p>I'd like to check against the index </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload