PHP code example of hvolschenk / utilities-array
1. Go to this page and download the library: Download hvolschenk/utilities-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/ */
hvolschenk / utilities-array example snippets
itemByKey(array $array): callable;
namespace Sample\Name\Space;
use function Hvolschenk\Utilities\Arrays\itemByKey;
$users = [
'designer' => [
['firstName' => 'Jason', 'lastName' => 'Coole']
],
'developer' => [
['firstName' => 'Derek', 'lastName' => 'Moonlander']
]
];
$usersByDesignation = itemByKey($users);
$usersByDesignation('designer'); // [['firstName' => 'Jason', 'lastName' => 'Coole']]
$usersByDesignation('developer'); // [['firstName' => 'Derek', 'lastName' => 'Moonlander']]
$usersByDesignation('boss'); // NULL
php composer.phar