Exemple #1
0
<?php

require dirname(__FILE__) . '/../../library/FabricationEngine.php';
$engine = new \Fabrication\FabricationEngine();
$engine->input('#greeting', $engine->create('div', 'World'));
$template = '<html><head></head><body><div id="greeting">Hello</div></body></html>';
$engine->run($template);
var_dump($engine->saveHTML());
<?php

require_once dirname(__FILE__) . '/../../library/FabricationEngine.php';
$engine = new Fabrication\FabricationEngine();
$engine->input('hello', 'world');
var_dump($engine->output('hello', 'php.array', array('tags' => false)));
<?php

require dirname(__FILE__) . '/../../library/FabricationEngine.php';
$workload = array(100, 1000, 10000, 100000);
foreach ($workload as $key => $load) {
    $engine = new \Fabrication\FabricationEngine();
    foreach (array_rand(range(0, $load), $load) as $number) {
        $engine->input($number, 'value');
        $engine->output($number);
    }
    echo $engine->timeTaken() . " seconds workload = {$load}\n";
    unset($engine);
}