This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
redir/includes/kohana/modules/codebench/classes/Bench/LtrimDigits.php

28 lines
551 B
PHP
Raw Normal View History

2011-07-20 12:57:07 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* @package Kohana/Codebench
* @category Tests
* @author Geert De Deckere <geert@idoe.be>
*/
class Bench_LtrimDigits extends Codebench {
public $description = 'Chopping off leading digits: regex vs ltrim.';
public $loops = 100000;
public $subjects = array
(
'123digits',
'no-digits',
);
public function bench_regex($subject)
{
return preg_replace('/^\d+/', '', $subject);
}
public function bench_ltrim($subject)
{
return ltrim($subject, '0..9');
}
}