Using in_array to find name then echo only values that were found?
<p>I'm sure my title wasn't really that helpful. What i'm trying to do is this, I have an array with names in them. I also have a dynamic array which is generated with a foreach from an external xml file. What I want to do is if a name(s) are found then echo each one out. I am still working on my PHP skills but I am at a loss at what to do to get this working the way I want it. I've searched for hours trying to find something that would work but nothing. I'm probably not searching right.</p>

<p>Here is the code that i'm trying to do.</p>

<pre><code>// This just gets how many players ore on the US team
$serverplayer = $gameME_sdk_object-&gt;client_api_serverinfo("".$ip."/players/usarmy");
        foreach($serverplayer['serverinfo'][0]['teams'] as $mainserver) {
            if($mainserver['name'] == "usarmy") {
                $dacount = $mainserver['count'];
            }
        }
        if($dacount &gt;= 1)
            // Begins Admin List/Count
            $admins = array("INFIDEL_HARE", "Romania191", "mardog104", "INFIDEL_JIHAD", "stvnsng", "HellKnightFire", "McThump", "INFIDEL_JByrns93", "INFIDEL_ALPHA", "s0ck37", "Zepppster", "xRingmasteressx", "FreeeKillz", "smokert", "Ccls2", "INFIDEL_GRIF", "cuzco2585", "Prophet731", "KittensDrunk", "Rexperience-EF", "Whickerbasket", "InfamousHoole", "Cruz_5326", "-Grimreaperx9-", "JoeyT2");
            foreach($serverplayer['serverinfo'][0]['players'] as $admname) {
                $Alist[] = $admname['name'];
                if(in_array($Alist, $admins)) {
                    $adminlist = $admname['name'];
                    $countAlist = count($adminlist);
                }
            }
            // Ends Admin List/Count
            // Everything below is just the data
            echo '&lt;div class="four-columns six-columns-tablet twelve-columns-mobile"&gt;';
            echo '&lt;pre&gt;';
            echo $adminlist;
            echo '&lt;/pre&gt;';
            echo "&lt;div class=\"table-header\"&gt;US (".$dacount.")&lt;/div&gt;";
            echo '&lt;table class="table responsive-table" id="scoreboard"&gt;';
            echo '&lt;thead&gt;';
            echo '&lt;tr&gt;';
            echo '&lt;th scope="col" width="2%"&gt;Sq&lt;/th&gt;
            &lt;th scope="col"&gt;Name&lt;/th&gt;
            &lt;th scope="col" width="2%"&gt;K&lt;/th&gt;
            &lt;th scope="col" width="2%"&gt;D&lt;/th&gt;
            &lt;th scope="col" width="5%" class="hide-on-mobile hide-on-tablet hide-on-mobile-portrait"&gt;Cheat Meter&lt;/th&gt;';
            echo '&lt;/tr&gt;&lt;/thead&gt;';
            echo '&lt;tbody&gt;';
            foreach($serverplayer['serverinfo'][0]['players'] as $player) {
                echo '&lt;tr&gt;';
                if ($player['team'] == "unassigned" Xor $player['team'] == "None") {            
                    $team = "&lt;small class=\"tag green-gradient glossy\"&gt;Joining&lt;/small&gt;";
                }
                echo "&lt;td class=\"low-padding\"&gt;".ucfirst($player['squad'])."&lt;/td&gt;";
                echo "&lt;td class=\"low-padding\"&gt;&lt;a href=\"http://battlelog.battlefield.com/bf3/user/".$player['name']."\" target=\"_blank\"&gt;&lt;img src=\"./img/battlelog.png\" alt=\"Battlelog Profile\" width=\"16\" height=\"16\"&gt;&lt;/a&gt;&amp;nbsp;".$player['name']."&lt;span style=\"float: right\"&gt;".$team."&lt;/span&gt;&lt;/th&gt;";
                echo '&lt;td&gt;'.$player['kills'].'&lt;/td&gt;';
                echo '&lt;td&gt;'.$player['deaths'].'&lt;/td&gt;';
                echo "&lt;td&gt;&lt;a href=\"http://panel.dev.adkgamers.com/?p=" . $player['name'] . "&amp;id=cheatometer\"target=\"_blank\"&gt;Check&lt;/a&gt;&lt;/td&gt;";
                echo '&lt;/tr&gt;';
            }
            echo '&lt;/tbody&gt;';
            echo '&lt;/table&gt;';
            echo '&lt;/div&gt;';
</code></pre>

<p>How would I go about doing this? If anyone knows how to or understands what i'm trying to do.</p>
