Home  >  Article  >  Backend Development  >  PHP addition operation example code in array_PHP tutorial

PHP addition operation example code in array_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:41:091110browse

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...
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