PHP code example of sensorario / biberon

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

    

sensorario / biberon example snippets


use Sensorario\Biberon\Biberon;
use Sensorario\Biberon\Detector;
use Sensorario\Biberon\Stat;

$show = new Sensorario\Biberon\Show(
    new Sensorario\Biberon\Detector(),
    (new Sensorario\Biberon\Stat())->init([
        'count' => 100,
        'columnsize' => 33,
    ])
);

while ($show->mustGoOn()) {
    $show->next(function() {
        return rand(11111, 99999);
    });
}

use Sensorario\Biberon\Detector;

$detector = new Detector();
$detector->setColors([
    'B' => Detector::COLOR_GREEN,
    'p' => Detector::COLOR_RED,
    'L' => Detector::COLOR_VIOLET,
]);
$detector->addRules([
    'L' => function ($input) { return $input < 10000; },
    'B' => function ($input) { return $input > 70000; },
    'p' => function ($input) { return $input % 2 == 0; },
    'd' => function ($input) { return $input % 2 == 1; },
]);

$data = [];
for ($i = 0; $i < 666; $i++) {
    $data[] = rand(1, 99999);
}

$show = new Sensorario\Biberon\Show(
    $detector,
    (new Sensorario\Biberon\Stat())->init([
        'count' => count($data),
        'column' => 0,
        'print' => 0,
        'columnsize' => 48,
    ])
);

while ($show->mustGoOn()) {
    $show->next(function() {
        return rand(11111, 99999);
    });
}