Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here you go :)</p> <pre><code>&lt;?PHP function get_nonfollowers($followingXml, $followersXml) { $following = simplexml_load_string($followingXml); $followers = simplexml_load_string($followersXml); $notFollowingMe = array(); foreach($following-&gt;users-&gt;user as $f) { $isFollowingMe = false; foreach($followers-&gt;users-&gt;user as $follower) { if(strcmp($follower-&gt;id, $f-&gt;id) == 0) { $isFollowingMe = true; break; } } if(!$isFollowingMe) $notFollowingMe[] = $f; } return $notFollowingMe; } $followingXml = &lt;&lt;&lt;EOF &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;users_list&gt; &lt;users type="array"&gt; &lt;user&gt; &lt;id&gt;66968592&lt;/id&gt; &lt;name&gt;DJ Swaggz &amp;#11013;click2fol&lt;/name&gt; &lt;screen_name&gt;DjSwaggz&lt;/screen_name&gt; &lt;/user&gt; &lt;user&gt; &lt;id&gt;288859268&lt;/id&gt; &lt;name&gt;tegan shanks&lt;/name&gt; &lt;screen_name&gt;teganxroshanks&lt;/screen_name&gt; &lt;/user&gt; &lt;/users&gt; &lt;/users_list&gt; EOF; $followersXml = &lt;&lt;&lt;EOF &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;users_list&gt; &lt;users type="array"&gt; &lt;user&gt; &lt;id&gt;66968592&lt;/id&gt; &lt;name&gt;DJ Swaggz &amp;#11013;click2fol&lt;/name&gt; &lt;screen_name&gt;DjSwaggz&lt;/screen_name&gt; &lt;/user&gt; &lt;/users&gt; &lt;/users_list&gt; EOF; $notFollowingMe = get_nonfollowers($followingXml, $followersXml); print_r($notFollowingMe); ?&gt; </code></pre> <p><strong>Output</strong></p> <pre><code>Array ( [0] =&gt; SimpleXMLElement Object ( [id] =&gt; 288859268 [name] =&gt; tegan shanks [screen_name] =&gt; teganxroshanks ) ) </code></pre> <p><strong>Loop through the screen names</strong></p> <pre><code>foreach($notFollowingMe as $user) { echo $user-&gt;screen_name . "\r\n"; } </code></pre>
 

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