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/StripNullBytes.php

37 lines
833 B
PHP
Raw Permalink 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_StripNullBytes extends Codebench {
public $description =
'String replacement comparisons related to <a href="http://dev.kohanaphp.com/issues/2676">#2676</a>.';
public $loops = 1000;
public $subjects = array
(
"\0",
"\0\0\0\0\0\0\0\0\0\0",
"bla\0bla\0bla\0bla\0bla\0bla\0bla\0bla\0bla\0bla",
"blablablablablablablablablablablablablablablabla",
);
public function bench_str_replace($subject)
{
return str_replace("\0", '', $subject);
}
public function bench_strtr($subject)
{
return strtr($subject, array("\0" => ''));
}
public function bench_preg_replace($subject)
{
return preg_replace('~\0+~', '', $subject);
}
}