PHP code example of chrisrhymes / extra-collect

1. Go to this page and download the library: Download chrisrhymes/extra-collect 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/ */

    

chrisrhymes / extra-collect example snippets


collect(['a', 'b', 'c'])->prefix('test');

// ['testa', 'testb', 'testc']


collect([['name' => 'a'], ['name' => 'b'], ['name' => 'c']])->prefix('test', 'name');

// [['name' => 'testa'], ['name' => 'testb'], ['name' => 'testc']]

collect(['a', 'b', 'c'])->suffix('test');

// ['atest', 'btest', 'ctest']


collect([['name' => 'a'], ['name' => 'b'], ['name' => 'c']])->suffix('test', 'name');

// [['name' => 'atest'], ['name' => 'btest'], ['name' => 'ctest']]

collect(['a', 'b', 'c'])->doubleQuote();

// ['"a"', '"b"', '"c"']


collect([['name' => 'a'], ['name' => 'b'], ['name' => 'c']])->doubleQuote('name');

// [['name' => '"a"'], ['name' => '"b"'], ['name' => '"c"']]