| 4 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
|
|
6 |
Copyright (C) 2014~2025 Min-Jhin,Chen
|
|
|
7 |
|
|
|
8 |
This file is part of QBPWCF.
|
|
|
9 |
|
|
|
10 |
QBPWCF is free software: you can redistribute it and/or modify
|
|
|
11 |
it under the terms of the GNU General Public License as published by
|
|
|
12 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
13 |
(at your option) any later version.
|
|
|
14 |
|
|
|
15 |
QBPWCF is distributed in the hope that it will be useful,
|
|
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
18 |
GNU General Public License for more details.
|
|
|
19 |
|
|
|
20 |
You should have received a copy of the GNU General Public License
|
|
|
21 |
along with QBPWCF. If not, see <http://www.gnu.org/licenses/>.
|
|
|
22 |
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
#使用命名空間qbpwcf
|
|
|
26 |
namespace qbpwcf;
|
|
|
27 |
|
|
|
28 |
#assets dir
|
|
|
29 |
$assetsDir="assets of arrays::mergeArray_20250419";
|
|
|
30 |
|
|
|
31 |
#陣列Caa
|
|
|
32 |
$arrayCaa=array("A"=>"a","B"=>"b","C"=>"c");
|
|
|
33 |
|
|
|
34 |
#陣列Ca
|
|
|
35 |
$arrayCa=array("A"=>"a","B"=>"b","C"=>$arrayCaa);
|
|
|
36 |
|
|
|
37 |
#陣列A
|
|
|
38 |
$arrayA=array("A"=>"a","B"=>"b","Ca"=>$arrayCa);
|
|
|
39 |
|
|
|
40 |
#陣列Eaa
|
|
|
41 |
$arrayEaa=array("D"=>"d","E"=>"e","F"=>"f");
|
|
|
42 |
|
|
|
43 |
#陣列Ea
|
|
|
44 |
$arrayEa=array("D"=>"d","E"=>$arrayEaa,"F"=>"f");
|
|
|
45 |
|
|
|
46 |
#陣列B
|
|
|
47 |
$arrayB=array("D"=>"d","Ea"=>$arrayEa,"F"=>"f");
|
|
|
48 |
|
|
|
49 |
#重複的陣列A
|
|
|
50 |
$repeatedA=$arrayA;
|
|
|
51 |
|
|
|
52 |
#重複的陣列B
|
|
|
53 |
$repeatedB=$arrayB;
|
|
|
54 |
|
|
|
55 |
#函式說明:
|
|
|
56 |
#將多個一維陣列串聯起來,key從0開始排序.
|
|
|
57 |
#回傳的結果:
|
|
|
58 |
#$result["status"],"true"表執行正常,"false"代表執行不正常.
|
|
|
59 |
#$result["error"],錯誤訊息陣列.
|
|
|
60 |
#$result["function"],當前執行的函數.
|
|
|
61 |
#$result["content"],合併好的一維陣列.
|
|
|
62 |
#必填參數
|
|
|
63 |
#$conf["inputArray"],陣列,要合併的一維陣列變數,例如:=array($array1,$array2);
|
|
|
64 |
$conf["inputArray"]=array($arrayA,$arrayB,$repeatedA,$repeatedB);
|
|
|
65 |
#可省略參數:
|
|
|
66 |
#$conf["allowRepeat"],字串,預設為"true",允許重複的結果;若為"false"則不會出現重複的元素內容.
|
|
|
67 |
$conf["allowRepeat"]="false";
|
|
|
68 |
#$conf["looseDiff"],字串,預設為"false",代表要嚴謹判斷為有相異,例如陣列中元素的key順序不同(整數)就代表有相異;反之為"true",例如陣列中元素的key順序不同(整數),但value有相對應且相同.
|
|
|
69 |
#$conf["looseDiff"]="false";
|
|
|
70 |
#參考資料:
|
|
|
71 |
#無.
|
|
|
72 |
#備註:
|
|
|
73 |
#無.
|
|
|
74 |
$mergeArray=arrays::mergeArray($conf);
|
|
|
75 |
unset($conf);
|
|
|
76 |
|
|
|
77 |
#debug
|
|
|
78 |
var_dump($mergeArray);
|