PHP code example of germanovs / php-keys-mover

1. Go to this page and download the library: Download germanovs/php-keys-mover 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/ */

    

germanovs / php-keys-mover example snippets


$keyMover = new KeysMover\KeysMover();
$array = [
    'one' => 1,
    'two' => 2,
    'three' => 3
];

$keyMover->move($array, 'one', 'two');
/*
result:
[
    'two' => 2,
    'one' => 1,
    'three' => 3
]
*/

$keyMover->move($array, 'two', 2);
/*
result:
[
    'one' => 1,
    'three' => 3,
    'two' => 2
]
*/
$keysMover->shift($array, 'three', -2);
$keysMover->moveAfter($array, 'three', 'two');