PHP code example of aznc / pipe-array

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

    

aznc / pipe-array example snippets


$score = [40, 55, 32, 63];

// add bonus and check passed score
$bonusScore = array_map(function($e){ return intval(sqrt($e) * 10); }, $score);
$passedScore = array_filter($bonusScore, function($e){ return $e >= 60; });

$score = [40, 55, 32, 63];

// add bonus and check passed score
$passedScore = Pipe::Start($score)
                ->map(function($e){ return intval(sqrt($e) * 10); })
                ->filter(function($e){ return $e >= 60; })
                ->rawData();

$pArray = Pipe::Start([1, 2, 3, 4, 5]);
$pArray->push(6);
var_dump($pArray[5]); // print 6

$pArray->pop();
var_dump($pArray->count()); // print 5

$phpArray = Pipe::Start(...)->map(...)->rawData();