Note that there are some explanatory texts on larger screens.

plurals
  1. POEcho a multi dimensional array
    primarykey
    data
    text
    <p>I have an multidimensional array of a player list for Call of Duty 4. When I try to echo the array it comes back with <code>Array</code> 30 times because there are 30 current players in the server.</p> <p>Var_Dump of $promodplist (Players List)</p> <pre><code>array(27) { [0]=&gt; array(6) { ["frags"]=&gt; string(1) "0" ["ping"]=&gt; string(2) "26" ["nick"]=&gt; string(10) "DIVINEBRAH" ["gq_name"]=&gt; string(10) "DIVINEBRAH" ["gq_score"]=&gt; string(1) "0" ["gq_ping"]=&gt; string(2) "26" } [1]=&gt; array(6) { ["frags"]=&gt; string(1) "0" ["ping"]=&gt; string(2) "35" ["nick"]=&gt; string(7) "&gt;&lt;&gt; &lt;&gt;&lt;" ["gq_name"]=&gt; string(7) "&gt;&lt;&gt; &lt;&gt;&lt;" ["gq_score"]=&gt; string(1) "0" ["gq_ping"]=&gt; string(2) "35" } [2]=&gt; array(6) { ["frags"]=&gt; string(1) "0" ["ping"]=&gt; string(2) "42" ["nick"]=&gt; string(10) "xXthe0neXx" ["gq_name"]=&gt; string(10) "xXthe0neXx" ["gq_score"]=&gt; string(1) "0" ["gq_ping"]=&gt; string(2) "42" } </code></pre> <hr> <pre><code>$servers['promod'] = array('cod4', '67.202.102.224'); $servers['promod2'] = array('cod4', '67.202.102.224'); $gq = new GameQ(); $gq-&gt;addServers($servers); $results = $gq-&gt;requestData(); function print_results($results) { foreach ($results as $id =&gt; $data) </code></pre> <p>And this is what I am trying to use to list the current players.</p> <pre><code>$promodplist = $data['promod']['players']; foreach($promodplist as $k =&gt; $v) </code></pre> <p>I just simply want to echo out the <code>nick</code> (nickname) in each array.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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