Heim >php教程 >php手册 >PHP 在数组中加法运算操作实例代码

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 10:39:391204Durchsuche

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn