PHP Classes

File: vendor/pimple/pimple/ext/pimple/tests/bench.phpb

Recommend this page to a friend!
  Classes of uche   Farm Price   vendor/pimple/pimple/ext/pimple/tests/bench.phpb   Download  
File: vendor/pimple/pimple/ext/pimple/tests/bench.phpb
Role: Example script
Content type: text/plain
Description: Example script
Class: Farm Price
API to get the prices from agriculture markets
Author: By
Last change:
Date: 2 years ago
Size: 713 bytes
 

Contents

Class file image Download
<?php

if (!class_exists('Pimple\Container')) {
    require_once
__DIR__ . '/../../../src/Pimple/Container.php';
} else {
    echo
"pimple-c extension detected, using...\n\n";
}

$time = microtime(true);

function
foo() { }
$factory = function () { };

for (
$i=0; $i<10000; $i++) {

$p = new Pimple\Container;

$p['foo'] = 'bar';

if (!isset(
$p[3])) {
   
$p[3] = $p['foo'];
   
$p[] = 'bar';
}

$p[2] = 42;

if (isset(
$p[2])) {
    unset(
$p[2]);
}

$p[42] = $p['foo'];

$p['cb'] = function($arg) { };

$p[] = $p['cb'];

echo
$p['cb'];
echo
$p['cb'];
echo
$p['cb'];

//$p->factory($factory);

$p['factory'] = $factory;

echo
$p['factory'];
echo
$p['factory'];
echo
$p['factory'];

}

echo
microtime(true) - $time;