- var_dump: documentation ( source)
- memory_get_peak_usage: documentation ( source)
- json_decode: documentation ( source)
<?php
$a = array();
for ($i = 0; $i < 10000; $i += 1) {
$a[] = json_decode('{"a": "b"}');
}
var_dump((memory_get_peak_usage() / 1024 / 1024) . "MB");