PHP code example of ta-tikoma / bind

1. Go to this page and download the library: Download ta-tikoma/bind 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/ */

    

ta-tikoma / bind example snippets


$result = 'Hello World'
    |> static fn (string $s) => explode(' ', $s)
    |> static fn (array $a) => array_filter($a, static fn (string $s) => str_starts_with($s, 'H'))

$result = 'Hello World'
    |> bind(flip(explode(...)), ' ')
    |> bind(array_filter(...), bind(str_starts_with(...), 'H'))

$result = collect(['1', '2', '3'])->map(static fn (string $number) => (int) $number);

$result = collect(['1', '2', '3'])->map(bind(intval(...)));