codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php function printUsedMemory(&$arr) // <----- explicit, user-land, pass-by-reference { $start_memory = memory_get_usage(); $arr[0] = 1; // WRITE! echo memory_get_usage() - $start_memory; // let's see the memory used whilst reading } $x = array_fill(0, 10000, 1); printUsedMemory($x);
Private
[
?
]
Run code
Submit