PHP Classes

File: bench/run.php

Recommend this page to a friend!
  Classes of Miraz Mac  >  PHP HTML Parser and Sanitizer  >  bench/run.php  >  Download  
File: bench/run.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP HTML Parser and Sanitizer
Parse and clean HTML code to keep secure tags
Author: By
Last change:
Date: 1 year ago
Size: 560 bytes
 

Contents

Class file image Download
<?php

use MirazMac\HtmlSanitizer\BasicWhitelist;
use
MirazMac\HtmlSanitizer\Sanitizer;

require_once
__DIR__ . '/../vendor/autoload.php';

$sanitizer = new Sanitizer(new BasicWhitelist);


echo
"Running...\n";

$input = file_get_contents(__DIR__.'/payload.html');
$times = 100;
$time = microtime(true);


for (
$i = 0; $i < $times; ++$i) {
   
$output = $sanitizer->sanitize($input);
}

$total = (microtime(true) - $time) * 1000;

echo
'Total for '.$times.' loops: '.round($total, 2)."ms\n";
echo
'Time per loop: '.round($total / $times, 2)."ms\n";
echo
"\n";