php 數(shù)組 array php函數(shù)
來源:易賢網(wǎng) 閱讀:648 次 日期:2014-10-27 14:19:00
溫馨提示:易賢網(wǎng)小編為您整理了“php 數(shù)組 array php函數(shù)”,方便廣大網(wǎng)友查閱!

重新學(xué)習(xí)一下php的相關(guān)函數(shù)定義等內(nèi)容,學(xué)習(xí)全部,加深印象,字母從a-z

首先學(xué)習(xí)php數(shù)組,array,數(shù)組定義,數(shù)組的初始化

看例子學(xué)習(xí)數(shù)組

例子1:有索引的數(shù)組

<?php

$forasp = array(size=>'forasp',domain=>'cn',name=>'');

//或者

print_r($forasp);

?>

輸出結(jié)果

array

(

[size] => forasp

[domain] => cn

[name] =>

)

例子2 無索引數(shù)組

<?php

$forasp = array(cn,2,3,4);

print_r($forasp);

?>

輸出結(jié)果:

array

(

[0] => cn

[1] => 2

[2] => 3

[3] => 4

)

例子3 二級數(shù)組以及多級數(shù)組

<?php

$forasp = array(class1=>一級數(shù)組內(nèi)容,class2=>array(content=>二級數(shù)組內(nèi)容));

print_r($forasp);

?>

輸出結(jié)果

array

(

[class1] => 一級數(shù)組內(nèi)容

[class2] => array

(

[content] => 二級數(shù)組內(nèi)容

)

)

例子4 動態(tài)添加數(shù)組內(nèi)容

<?php

$forasp =array();

 $forasp[]=anypoetry.com;//有索引內(nèi)容

$forasp[] = 網(wǎng)站制作學(xué)習(xí)網(wǎng);//無索引內(nèi)容

print_r($forasp);

?>

輸出結(jié)果

array

(

[0] => anypoetry.com

[1] => 網(wǎng)站制作學(xué)習(xí)網(wǎng)

)

這就是php數(shù)組array的基本定義,下次繼續(xù)說php的相關(guān)的操作函數(shù)

更多信息請查看IT技術(shù)專欄

更多信息請查看網(wǎng)絡(luò)編程
易賢網(wǎng)手機(jī)網(wǎng)站地址:php 數(shù)組 array php函數(shù)
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機(jī)號
  • 驗證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報警專用圖標(biāo)