Blogger Information
Blog 28
fans 0
comment 1
visits 13393
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
# PHP学习之常用函数联系
centos
Original
480 people have browsed it

PHP学习之常用函数联系

  1. <?php
  2. //if分支
  3. $a = "阴天" ;
  4. if($a == "晴天"){
  5. echo "爬山去";
  6. }else if($a == '阴天'){
  7. echo "依然爬山";
  8. }else {
  9. echo "加班";
  10. }
  11. echo '<br>';
  12. //三元 ?:
  13. $f = '';
  14. echo $f ?'出去吃饭':'回家睡觉';
  15. echo '<br>';
  16. //加密
  17. echo md5('admin');
  18. echo '<br>';
  19. echo strlen('21232f297a57a5a743894a0e4a801fc3');
  20. echo '<br>';
  21. echo sha1('admin');
  22. echo '<br>';
  23. echo strlen('d033e22ae348aeb5660fc2140aec35850c4da997');
  24. echo '<br>';
  25. //数组或者对象中属性个数 count
  26. $arr = [
  27. 'niHao',
  28. 'meiHao',
  29. 123,
  30. '欧呦',
  31. ];
  32. echo count($arr);
  33. echo '<br>';
  34. //初始化 unset
  35. //合并函数 array_merge
  36. $item1 = [
  37. 1,
  38. 2,
  39. 3,
  40. 4,
  41. ];
  42. $item2 = [
  43. 2,
  44. 3,
  45. 4,
  46. ];
  47. print_r (array_merge($item1,$item2));
  48. echo '<br>';
  49. //去重 array_unique
  50. print_r (array_unique(array_merge($item1,$item2)));
  51. echo '<br>';
  52. //数组转字符 implode
  53. echo implode('==',$item2);
  54. echo '<br>';
  55. //字符转数组 explode
  56. $str = '欧阳克1灭绝师太2朱老师3西门大官人';
  57. print_r (explode('1',$str));
  58. // & 地址引用符
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