xref: /PHP-8.1/Zend/tests/bug40809.phpt (revision 1a3bdb4a)
1--TEST--
2Bug #40809 (Poor performance of ".=")
3--FILE--
4<?php
5
6$num_increments = 100;
7$num_repeats = 1000;
8$increment = 50;
9
10/* Create some more holes to give the memory allocator something to
11 * work with. */
12$num = 5000;
13$a = Array();
14for ($i=0; $i<$num; $i++) {
15  $a[$i] = Array(1);
16}
17for ($i=0; $i<$num; $i++) {
18  $b[$i] = $a[$i][0];
19}
20unset($a);
21
22for ($i=0;$i<$num_repeats;$i++) {
23  $evil = "";
24  for ($j=0;$j<$num_increments;$j++) {
25    $evil .= str_repeat("a", $increment);
26  }
27  unset($evil);
28}
29echo "ok\n";
30?>
31--EXPECT--
32ok
33