Subversion Repositories php-qbpwcf

Rev

Rev 81 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2014~2025 MIN ZHI, CHEN

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/

#使用命名空間qbpwcf
namespace qbpwcf;

#assets dir
$assetsDir="assets of arrays::mergeArray_20250430";

#陣列A
/*
[0]=>
      array(4) {
        ["ip"]=>
        string(1) "*"
        ["port"]=>
        string(2) "80"
        ["DocumentRoot"]=>
        string(15) "/var/www/qbpwcf"
        ["ServerName"]=>
        string(27) "silverblue-guest.qbpwcf.org"
}
*/
$arrayA=array(array("ip"=>"*","port"=>"80","DocumentRoot"=>"/var/www/qbpwcf","ServerName"=>"silverblue-guest.qbpwcf.org"));

#陣列B
/*
[1]=>
      array(4) {
        ["ip"]=>
        string(1) "*"
        ["port"]=>
        string(3) "443"
        ["DocumentRoot"]=>
        string(15) "/var/www/qbpwcf"
        ["ServerName"]=>
        string(18) "ws-sock.qbpwcf.org"
}
*/
$arrayB=array(array("ip"=>"*","port"=>"443","DocumentRoot"=>"/var/www/qbpwcf","ServerName"=>"ws-sock.qbpwcf.org"));

#函式說明:
#將多個一維陣列串聯起來,key從0開始排序.
#回傳的結果:
#$result["status"],"true"表執行正常,"false"代表執行不正常.
#$result["error"],錯誤訊息陣列.
#$result["function"],當前執行的函數.
#$result["content"],合併好的一維陣列.
#必填參數
#$conf["inputArray"],陣列,要合併的一維陣列變數,例如:=array($array1,$array2);
$conf["inputArray"]=array($arrayA,$arrayB);
#可省略參數:
#$conf["allowRepeat"],字串,預設為"true",允許重複的結果;若為"false"則不會出現重複的元素內容.
$conf["allowRepeat"]="false";
#$conf["looseDiff"],字串,預設為"false",代表要嚴謹判斷為有相異,例如陣列中元素的key順序不同(整數)就代表有相異;反之為"true",例如陣列中元素的key順序不同(整數),但value有相對應且相同.
#$conf["looseDiff"]="false";
#參考資料:
#無.
#備註:
#無.
$mergeArray=arrays::mergeArray($conf);
unset($conf);

#debug
var_dump($mergeArray);