久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

回顯多維數(shù)組

Echo a multi dimensional array(回顯多維數(shù)組)
本文介紹了回顯多維數(shù)組的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個《使命召喚 4》玩家列表的多維數(shù)組.當(dāng)我嘗試回顯該數(shù)組時,它返回 Array 30 次,因為服務(wù)器中有 30 個當(dāng)前玩家.

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 Array 30 times because there are 30 current players in the server.

$promodplist 的 Var_Dump(玩家列表)

Var_Dump of $promodplist (Players List)

array(27) { 
    [0]=> array(6) { 
        ["frags"]=> string(1) "0" 
        ["ping"]=> string(2) "26"
        ["nick"]=> string(10) "DIVINEBRAH"
        ["gq_name"]=> string(10) "DIVINEBRAH"
        ["gq_score"]=> string(1) "0"
        ["gq_ping"]=> string(2) "26" 
    }
    [1]=> array(6) {
        ["frags"]=> string(1) "0" 
        ["ping"]=> string(2) "35" 
        ["nick"]=> string(7) "><> <><" 
        ["gq_name"]=> string(7) "><> <><" 
        ["gq_score"]=> string(1) "0" 
        ["gq_ping"]=> string(2) "35" 
    } 
    [2]=> array(6) { 
        ["frags"]=> string(1) "0" 
        ["ping"]=> string(2) "42" 
        ["nick"]=> string(10) "xXthe0neXx" 
        ["gq_name"]=> string(10) "xXthe0neXx" 
        ["gq_score"]=> string(1) "0" 
        ["gq_ping"]=> string(2) "42" 
    } 

<小時>

$servers['promod'] = array('cod4', '67.202.102.224');
$servers['promod2'] = array('cod4', '67.202.102.224');
$gq = new GameQ();
$gq->addServers($servers);
$results = $gq->requestData();
function print_results($results) {
foreach ($results as $id => $data)

這就是我試圖用來列出當(dāng)前球員的內(nèi)容.

And this is what I am trying to use to list the current players.

$promodplist = $data['promod']['players'];
foreach($promodplist as $k => $v)

我只是想回顯每個數(shù)組中的 nick(昵稱).

I just simply want to echo out the nick (nickname) in each array.

推薦答案

$promodplist = $data['promod']['players'];
foreach($promodplist as $k => $v)
    print($v['nick']);

應(yīng)該做你想做的.foreach 遍歷數(shù)組中的鍵/值對,其中 $k 是元素的鍵(在您的情況下是基于 0 的索引),而 $v 是值(玩家數(shù)據(jù)的數(shù)組,對于您而言).您可以通過使用其名稱作為 數(shù)組訪問器.

Should do what you want. foreach iterates through the key/value pairs in the array, where $k is the element's key (a 0-based index, in your case) and $v is the value (an array of player data, for you). You can access the rest of the information by using its name as the key in the array accessor.

這篇關(guān)于回顯多維數(shù)組的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設(shè)置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 国产精品美女久久久久久免费 | 日韩精品一区二 | 国产精品一区二区在线 | av影音| 国产精品一区二区视频 | 亚洲欧美日韩久久 | 久久久久久国产精品免费免费狐狸 | 亚洲一区免费 | 久久精品成人 | 久久国产视频网 | 欧美成人a∨高清免费观看 色999日韩 | 99热最新网址| 免费a网站 | 国产一区二区免费在线 | 国产精品久久久久久久久久 | av一区在线观看 | 欧美一级网站 | 久久精品电影 | 日韩欧美中文字幕在线观看 | 久久久久久九九九九 | 亚洲一区二区电影网 | 天天看天天爽 | h视频在线免费 | 男女污污动态图 | 中文字幕一区二区三区四区五区 | 精品一区二区在线观看 | 一区视频 | 欧美一级小视频 | 欧美视频精品 | 欧美另类视频 | 香蕉久久网 | 日韩欧美在线观看视频网站 | 午夜一级做a爰片久久毛片 精品综合 | 日日操夜夜操视频 | 成人在线小视频 | 国产成人精品999在线观看 | 天天干.com| 亚洲综合精品 | 99热在线免费 | 欧洲一区二区在线 | 色片在线观看 |