Home  >  Article  >  Backend Development  >  请指点,php数组有关问题

请指点,php数组有关问题

WBOY
WBOYOriginal
2016-06-13 11:58:56927browse

请指点,php数组问题。
这是我在其他网站看到的题,请指点 

<br />//这是标准数组,一目了然,但是 title=>$Img['title']是什么意思??title的值是Img数组中Title吗?还是什么?<br />$item=array(<br />		 array('title'=>$Img['title'],'description'=>$Img['text'],'pic'=>$Img['pic'],'url'=>$url),<br />		 array('title'=>$Img['title'],'description'=>$Img['text'],'pic'=>$Img['pic'],'url'=>$url),<br />		 array('title'=>$Img['title'],'description'=>$Img['text'],'pic'=>$Img['pic'],'url'=>$url),<br />		 array('title'=>$Img['title'],'description'=>$Img['text'],'pic'=>$Img['pic'],'url'=>$url),<br />				);



下面的数组更复杂,请指点,到达代表啥意思??请详细点,新手。。。
array(9) {
  [0] => array(4) {
    ["title"] => string(21) "什么是销?"
    ["text"] => string(66) "销是现代一种低成本、高性价比的营销手段。"
    ["pic"] => string(38) "http://cdn.ipai.com/1396127866.jpg"
    ["url"] => string(0) ""
  }
  [1] => array(4) {
    ["title"] => string(23) "文章 马伊俐 姚笛"
    ["text"] => string(23) "文章 马伊俐 姚笛"
    ["pic"] => string(38) "http://cdn.ipii.com/1397285480.jpg"
    ["url"] => string(0) ""
  }
  [2] => array(4) {
    ["title"] => string(18) "点击修改密码"
    ["text"] => string(0) ""
    ["pic"] => string(38) "http://cdn.44.com/1398879995.png"
    ["url"] => string(55) "http://v.44.com/index/reg/wecha/'.$formuser.'/shtml"
  }
  [3] => array(4) {
    ["title"] => string(4) "m马"
    ["text"] => string(6) "描述"
    ["pic"] => string(38) "http://cdn.ip.com/1398638713.jpg"
    ["url"] => string(0) ""
  }
};
------解决方案--------------------
array('title'=>$Img['title'])
指的是键名为title的键值 = $Img数组里键名为title的值;

你说的第二个更复杂的数组,它一点也不复杂,只是一个普通二维数组,它打印出来显示 array(4)  、array(4)  ,不要把这个理解为数组。
你定义一个二维数组,然后var_dump($arr)就知道了。
------解决方案--------------------
<br />$a = $Img['title'];<br />........<br />array('title'=>$a,........<br />

跟你的等价

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn