, (*1)
A helper in emeraldinspiration's library., (*2)
The goal of this project is to hold commonly used functions that assist in manipulating base PHP datatypes., (*3)
This project has no dependencies, so can simply be required with composer, (*4)
composer require emeraldinspirations/lib-helper-array
array_map
using
a function inside the array elements<?php 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']
<?php use emeraldinspirations\library\helper\phpArray\PhpArray; $Array1 = ['Foo', 'FooBar', 'Bar' ]; $Array2 = [ 'foo', 'Bar', 'bar']; return PhpArray::xor($Array1, $Array2), // Returns: ['Foo', 'FooBar', 'foo', 'bar'];
I hope to expand this class to include other functions. If you'd like to contribute, please fork the repository and use a feature branch. I am new to gitHub and am eager to receive a Pull request to learn how it is done., (*5)
I am also open to feedback about how well I am being compliant with standards and "best practices." I have written software solo for years, and am trying to learn how to work better with others., (*6)
The code in this project is licensed under MIT license., (*7)