import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / 004.php
blobf6c9beb037cbf646fc4344cec8cdee0f29f0ee38
1 <?php
2 function stats($f, $a) {
3 $times = 90000;
4 print "$f\n";
5 ksort($a);
6 foreach($a as $k => $v)
7 print "$k: $v: " . sprintf('%0.3f', $v / $times) . "\n";
9 $a = array();
10 $times = 90000;
11 for ($i = 0; $i < $times; $i++) {
12 $p = range(1,4);
13 shuffle($p);
14 $s = join('', $p);
15 if (empty($a[$s])) $a[$s] = 0;
16 $a[$s]++;
19 stats('shuffle', $a);
20 $a = array();
21 $times = 90000;
22 for ($i = 0; $i < $times; $i++) {
23 $p = '1234';
24 $s = str_shuffle($p);
25 if (empty($a[$s])) $a[$s] = 0;
26 $a[$s]++;
29 stats('str_shuffle', $a);