PHP code example of emeraldinspirations / lib-helper-array

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

    

emeraldinspirations / lib-helper-array example snippets




use emeraldinspirations\library\helper\phpArray\PhpArray;

class DummyObject
{
    public function test(...$Append)
    {
        return $Char . implode('', $Append);
    }
    public function __construct($Char)
    {
        $this->Char = $Char;
    }
}

$Array = [
    new DummyObject('A'),
    new DummyObject('B'),
    new DummyObject('C'),
];

return PhpArray::mapElementFunction('Test', $Array, 1, 2, 3);

// Returns: ['A123', 'B123', 'C123']



use emeraldinspirations\library\helper\phpArray\PhpArray;

$Array1         = ['Foo', 'FooBar',        'Bar'       ];
$Array2         = [                 'foo', 'Bar', 'bar'];

return PhpArray::xor($Array1, $Array2),

// Returns:       ['Foo', 'FooBar', 'foo',        'bar'];