PHP code example of nabeghe / arrayer
1. Go to this page and download the library: Download nabeghe/arrayer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nabeghe / arrayer example snippets
use Nabeghe\Arrayer\Arrayer;
$data1 = ['key_1' => 'value_1', 'key_3' => ['key_3_1' => 'value_3_1']];
$data2 = ['key_2' => 'value_2'];
$data3 = ['key_3' => ['key_3_2' => 'value_3_2']];
$arrayer = new Arrayer();
print_r($arrayer->merge($data1, $data2, $data3)->data);
/*
Array
(
[key_1] => value_1
[key_3] => Array
(
[key_3_1] => value_3_1
[key_3_2] => value_3_2
)
[key_2] => value_2
)
*/