Heim  >  Artikel  >  php教程  >  php 数组的用法

php 数组的用法

WBOY
WBOYOriginal
2016-06-13 11:16:36985Durchsuche

 

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] => ) )

下面是对二维数组的用法
for($i=0;$i{
for($j=0;$j  {
     echo $array[$j][userid];
  }
}
因为它是个多维数组,一般用
foreach ($arr as $key => $value) {
    echo "Key: $key; Value: $value
n";
}
($array[$i]);$j++)
($array);$i++)


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn