欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

PHP 在数组中加法运算操作实例代码_PHP教程

程序员文章站 2022-05-21 11:11:36
...
PHP 在数组中加法运算操作实例代码

  1. $a = array("a" => "apple", "b" => "banana");
  2. $b = array("a" => "pear", "b" => "strawberry", "c" => "cherry");
  3. $c = $a $b; // Union of $a and $b
  4. echo "Union of $a and $b: ";
  5. var_dump($c);
  6. $c = $b $a; // Union of $b and $a
  7. echo "Union of $b and $a: ";
  8. var_dump($c);
  9. ?>
  10. array(3) {
  11. ["a"]=>
  12. string(5) "apple"
  13. ["b"]=>
  14. string(6) "banana"
  15. ["c"]=>
  16. string(6) "cherry"
  17. }
  18. Union of $b and $a:
  19. array(3) {
  20. ["a"]=>
  21. string(4) "pear"
  22. ["b"]=>
  23. string(10) "strawberry"
  24. ["c"]=>
  25. string(6) "cherry"
  26. }
  27. ?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486165.htmlTechArticlePHP 在数组中加法运算操作实例代码 ?php $a = array("a" = "apple", "b" = "banana"); $b = array("a" = "pear", "b" = "strawberry", "c" = "cherry"); $c = $a $b; // Union of...