<?php
class example {
    function 
html($value) {
        return 
htmlentities($value);
    }
}

function 
html($value) {
    return 
htmlentities($value);
}

require_once 
'Solar.php';
Solar::start();

$timer Solar::object('Solar_Debug_Timer');
$value "<bold>this and that</bold>\n";
$array = (array) $value;
$example = new example();
$func 'html';

$k 100000;

$timer->start();

// native php
for ($i 0$i $k$i++) {
    
$out htmlentities($value);
}
$timer->mark('native');

// literal func
for ($i 0$i $k$i++) {
    
$out html($value);
}
$timer->mark('literal_func');

// variable-function
for ($i 0$i $k$i++) {
    
$out $func($value);
}
$timer->mark('variable_func');

// literal method
for ($i 0$i $k$i++) {
    
$out $example->html($value);
}
$timer->mark('literal_method');

// varible-method
for ($i 0$i $k$i++) {
    
$out $example->$func($value);
}
$timer->mark('variable_method');

// call_user_func (func)
for ($i 0$i $k$i++) {
    
$out call_user_func($func$value);
}
$timer->mark('call_func');

// call_user_func (object)
for ($i 0$i $k$i++) {
    
$out call_user_func(
        array(
$example$func),
        
$value
    
);
}
$timer->mark('call_object');

// call_user_func_array (func)
for ($i 0$i $k$i++) {
    
$out call_user_func_array($func$array);
}
$timer->mark('cufa_func');

// call_user_func_array (object)
for ($i 0$i $k$i++) {
    
$out call_user_func_array(
        array(
$example$func),
        
$array
    
);
}
$timer->mark('cufa_object');

$timer->stop();
$timer->display();
?>