<?php
//php数组
//1.声明数组
$arr =array();
$arr[0]='hello';
$arr[1]='world';
$arr[2]=2;
$arr[3]=3.14;
print_r($arr);
echo '<br>';
//2.键值对
$obj = array();
$obj['h']='Hello';
$obj['w']='world';
$obj['x']='BowenXu';
echo $obj['x'];//调用
//3.声明的同时赋值
$arr2 = array(0=>'bowen',1=>'xu',2=>2,3=>3.14);
print_r($arr2);
echo '<br>';
$arr3 =array('h'=>'Hello','w'=>'world','r'=>'rose');
echo $arr3['r'];
08_PHP数组,键值对
最新推荐文章于 2022-03-15 18:00:00 发布