aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Benchmarks/bigtable/php.php
blob: f2e51a41f40a0baa58b357ef024c9b2d4012004a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
$table = array_fill(0, 1000, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));

function test_bigtable($table) {
	ob_start();
?>
<table>
<?php foreach($table as $row) { ?>
<tr>
<?php foreach($row as $value) { ?>
<td><?php echo $value; ?></td>
<?php } ?>
</tr>
<?php } ?>
</table>
<?php
	return ob_get_clean();
}

$request_count = 1000;

$start = microtime(true);
for ($i = 0; $i < $request_count; $i++)
{
  test_bigtable($table);
}
$elapsed = microtime(true) - $start;
$time_per_request = ($elapsed / $request_count) * 1000;
echo "\"PHP\", $time_per_request\n";
?>