Blogger Information
Blog 42
fans 0
comment 0
visits 15682
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0811队列,数组函数的功能
小言
Original
325 people have browsed it

队列

1.尾部追加。头部删除

  1. echo array_unshift($arr, 30, 50) .'<hr>';
  2. print_r($arr);
  3. echo array_push($arr).'<br>';
  4. echo array_shift($arr).'<hr>';

2.头部追加。尾部删除

  1. echo array_unshift($arr, 50, 100) .'<hr>';
  2. print_r($arr);
  3. echo array_unshift($arr).'<br>';
  4. echo array_pop($arr).'<br>';

数组函数的功能

  1. //移除重复的值
  2. $a=array('a'=>'赵','b'=>'钱','c'=>'赵');
  3. print_r(array_unique($a));
  4. echo '<hr>';
  5. //返回数组中的键名
  6. $b=array('a'=>'赵','b'=>'钱','c'=>'赵');
  7. echo array_search("赵",$a);
  8. echo '<hr>';
  9. //返回包含所有键名的新数组
  10. $c=array('a'=>'赵','b'=>'钱','c'=>'赵');
  11. print_r(array_keys($c));
  12. echo '<hr>';
  13. //反转数组中所有的键关联的值
  14. $d=array('a'=>'赵','b'=>'钱','c'=>'李');
  15. $result=array_flip($d);
  16. print_r($result);
  17. echo '<hr>';
  18. //返回数组的所有值
  19. $a=array('a'=>'赵','b'=>'钱','c'=>'李');
  20. print_r(array_values($a));

Correcting teacher:PHPzPHPz

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