Blogger Information
Blog 33
fans 1
comment 0
visits 22011
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
4-29数组系统函数的操作
冰雪琉璃
Original
552 people have browsed it

如何将以下二维数组里的键值name换成user ,其他保持不变?

$data = ‘name’=>’zhangdan’,’id’=>2,’name’=>’lisi’,’id’=>1;

  1. $data = [['name'=>'zhangdan','id'=>2], ['name'=>'lisi','id'=>1]]; foreach($data as $k=>$v){
  2. $data[$k]["user"]=$k["name"];
  3. } ;
  4. print_r($data);

生成一个由1-100组成的数组,要求返回该数组中的偶数组成的新数组,并且新数组的索引从0开始?

  1. $func = function($value) {
  2. return $value * 2;
  3. };
  4. echo '<pre>';
  5. print_r(array_map($func, range(1, 50)));
Correcting teacher:灭绝师太灭绝师太

Correction status:qualified

Teacher's comments:第二个作业思路新奇, 看好你哦~
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post