<?php
echo "Init: ".memory_get_usage() . PHP_EOL . PHP_EOL;
$test = $test2 = array();
$i = 0;
while ($i++ < 100000) {
$test[] = $i;
$test2[] = $i;
}
// test loop 1
echo "Test 1: ".memory_get_usage() . PHP_EOL;
foreach ($test as $k => $v) {
unset($test[$k]);
echo memory_get_usage() . PHP_EOL . PHP_EOL;
break;
}
// test loop 2
echo "Test 2: ".memory_get_usage() . PHP_EOL;
foreach ($test2 as $k => &$v) {
unset($test2[$k]);
echo memory_get_usage() . PHP_EOL . PHP_EOL;
break;
}
- Output for 7.3.0 - 7.3.1
- Init: 388752
Test 1: 8785744
12984224
Test 2: 8785744
8785792
- Output for 7.2.0 - 7.2.13
- Init: 384992
Test 1: 8781984
12980464
Test 2: 8781984
8782032
- Output for 7.1.25
- Init: 348384
Test 1: 8745376
12943856
Test 2: 8745376
8745424
- Output for 7.1.0, 7.1.7
- Init: 348456
Test 1: 8745448
12943928
Test 2: 8745448
8745496
- Output for 7.1.5 - 7.1.6
- Init: 348920
Test 1: 8745912
12944392
Test 2: 8745912
8745960
- Output for 7.0.0 - 7.0.20
- Init: 348480
Test 1: 8745472
12943952
Test 2: 8745472
8745520
- Output for 5.6.0 - 5.6.28
- Init: 219872
Test 1: 24718008
34566872
Test 2: 24718104
24718000
- Output for 5.5.0 - 5.5.38
- Init: 219872
Test 1: 24717816
34566680
Test 2: 24717936
24717848
- Output for 5.4.10 - 5.4.45
- Init: 220392
Test 1: 24718512
34567376
Test 2: 24718608
24718520
- Output for 5.4.0 - 5.4.9
- Init: 219864
Test 1: 24717848
34566712
Test 2: 24717976
24717888
- Output for 5.3.11 - 5.3.29
- Init: 625008
Test 1: 25123032
34971912
Test 2: 25123160
25123072
- Output for 5.3.0 - 5.3.10
- Init: 624704
Test 1: 25122720
34971600
Test 2: 25122872
25122784
- Output for 5.2.10 - 5.2.17
- Init: 83608
Test 1: 23782888
33631760
Test 2: 23782704
23782624
- Output for 5.2.7 - 5.2.9
- Init: 84320
Test 1: 23785704
33634672
Test 2: 23914008
23913896
- Output for 5.2.6
- Init: 84640
Test 1: 23786000
33634968
Test 2: 23914256
23914144
- Output for 5.2.3 - 5.2.5
- Init: 84640
Test 1: 23785864
33634832
Test 2: 23914152
23914040
- Output for 5.2.2
- Init: 82568
Test 1: 23783816
33632776
Test 2: 23912096
23911960
- Output for 5.2.1
- Init: 82568
Test 1: 23782768
33631720
Test 2: 23813664
33631768
- Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
- Fatal error: Call to undefined function memory_get_usage() in /in/nSmSZ on line 3
Process exited with code 255. - Output for 4.4.2 - 4.4.9
- Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/nSmSZ on line 21
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
- Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/nSmSZ on line 21
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/nSmSZ on line 21
Process exited with code 255.
preferences:
167.66 ms | 401 KiB | 232 Q