php數組相關函數,遍曆數組

來源:互聯網
上載者:User

1、php數組相關函數

bool sort ( array &array [, int sort_flags] ) 對數組進行排序

bool natsort ( array &array ) 用自然排序法對數組進行排序

int count ( mixed var [, int mode] ) 計算數組中單元數組或對象中屬性的個數, sizeof 的同名函數

輸出數組

PHP中輸出數組的函數有比較多,常用的有

bool print_r ( mixed expression [, bool return] )

2、從數組中遍曆讀取資料

foreach (array_expr as $value)

{ statement    }

foreach (array_expr as $key=>$value)

{ statement   }

提取每個鍵/值對,直到獲得所有項或滿足某些內部條件為止

3、PHP數組包含兩個項,key和value,可以通過key來擷取相應的value,其中key又可以是數值和關聯的,如$array[0],$array[one]。

原文:

http://blog.csdn.net/greyls/article/details/5707579

http://www.phpk8.com/article/e5/135.html

http://www.phpstudy.net/a.php/13.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.