1. Go to this page and download the library: Download phpbench/cellular 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/ */
$table = new Table(
new Row(array(
'col1' => new Cell(12),
'col2' => new Cell(14),
'col3' => new Cell(4),
)),
new Row(array(
'col1' => new Cell(12),
'col2' => new Cell(14),
'col3' => new Cell(4),
)),
);
$table->getValues(); // return an array containg all cell values
$table->getRow(0)->getValues();
$table->getColumn('col1')->getValues();
$table->createAndAddRow()
->set('hello, 'vaue', array('group1'));
var_dump($table->getCells(array('group1'))); // dump all cells in group1
$table->mapValues(function ($value) {
return 'goodbye';
}, array('group1')); // set the value of all cells in group1 to "goodbye"
$mean = Calculator::mean($table); // return the mean (average) value of the table
$median = Calculator::median($table->getRow(0)); // return the median value of the first row
$deviation = Calculator::deviation(
Calculator::mean($table->getColumn('col1')),
$table->getRow(0)->getCell('col1')
); // return the deviation of "col1" in the first row as a percentage from the average value of "col1"