程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> php 讀取多維數組方法

php 讀取多維數組方法

編輯:關於PHP編程

php 讀取多維數組方法

for($i=0;$i<count($array);$i++)
{
for($j=0;$j<count($array[$i]);$j++)
  {
     echo $array[$j][userid];
  }
}
因為它是個多維數組,一般用
foreach ($arr as $key => $value) {
    echo "Key: $key; Value: $value<br />\n";
}

Array ( [0] => Array ( [userid] => 1 [username] => 劉振鵬 [status] => 0 [userpwd] => ) [1] => Array ( [userid] => 2 [username] => 劉鵬飛 [status] => 0 [userpwd] => ) [2] => Array ( [userid] => 3 [username] => 劉朋 [status] => 0 [userpwd] => ) [3] => Array ( [userid] => 4 [username] => admin [status] => 0 [userpwd] => ) [4] => Array ( [userid] => 11 [username] => admin [status] => 0 [userpwd] => ) [5] => Array ( [userid] => 12 [username] => admin [status] => 0 [userpwd] => ) [6] => Array ( [userid] => 13 [username] => liuzp [status] => 0 [userpwd] => ) [7] => Array ( [userid] => 14 [username] => lzp [status] => 0 [userpwd] => ) )

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved