<?php
function foo(array $a) {
echo memory_get_usage(), PHP_EOL;
echo count($a), PHP_EOL;
echo memory_get_usage(), PHP_EOL;
}
$array = range(1, 1000000);
echo memory_get_usage(), PHP_EOL;
foo($array);
echo memory_get_usage(), PHP_EOL;
- Output for 7.4.0 - 7.4.1
- 33946024
33946056
1000000
33946056
33946056
- Output for 7.3.0 - 7.3.13
- 33946000
33946032
1000000
33946032
33946032
- Output for 7.2.0 - 7.2.26
- 33942184
33942216
1000000
33942216
33942216
- Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
- 33905592
33905624
1000000
33905624
33905624
- Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
- Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/Q8Rua on line 9
Process exited with code 255. - Output for 5.2.3 - 5.2.17
- Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/Q8Rua on line 9
Process exited with code 255. - Output for 5.2.1 - 5.2.2
- Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/Q8Rua on line 9
Process exited with code 255. - Output for 5.1.0 - 5.1.6, 5.2.0
- Fatal error: Call to undefined function memory_get_usage() in /in/Q8Rua on line 10
Process exited with code 255. - Output for 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/Q8Rua on line 3
Process exited with code 255. - Output for 4.4.2 - 4.4.9
- Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /in/Q8Rua on line 3
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 T_ARRAY, expecting ')' in /in/Q8Rua on line 3
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `')'' in /in/Q8Rua on line 3
Process exited with code 255.
preferences:
217.72 ms | 401 KiB | 325 Q