PHP code example of xtompie / collection
1. Go to this page and download the library: Download xtompie/collection 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/ */
xtompie / collection example snippets
echo Collection::of(['Alice', 'bob', 'Charlie', null])
->filter(function (?string $name) {
return $name !== null;
})
->map(function (string $name) {
return ucfirst($name);
})
->implode(', ')
;