PHP code example of fortress / array-comparison

1. Go to this page and download the library: Download fortress/array-comparison 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/ */

    

fortress / array-comparison example snippets


$expected = [
    'object' => [
        'to_be_removed' => [
            'item1',
            'item2',
        ],
        'to_be_changed' => [
            'item3',
            'item4',
        ]
    ]
];

$actual = [
    'object' => [
        'to_be_added' => [
            'item3',
            'item4',
        ],
        'to_be_changed' => [
            'item5',
            'item6',
        ],
    ]
];

$comparison = new Fortress\ArrayComparison();
$comparison->getDiff($expected, $actual);