An Elementary Cellular Automata library for PHP. All credit goes to Stephen Wolfram and Melanie Mitchell.
use Automata\Automata;
$automata = new Automata();
$result = $automata->generate(110, 4, '01010');
$result->toArray();
use Automata\CellsFactory;
use Automata\RulesFactory;
use Automata\Iterator;
$cellsFactory = new CellsFactory();
$cells = $cellsFactory->create("01010");
$rulesFactory = new RulesFactory();
$rules = $rulesFactory->create(110);
$iterator = new Iterator(new Iterate(), $cells, $rules);
$iterations = $iterator->iterate(4);
$iterations->toArray();
000 = 0
001 = 1
010 = 1
011 = 1
100 = 0
101 = 1
110 = 1
111 = 0