Get the peak memory usage of a PHP script

// true reports memory the OS actually gave PHP, not what PHP handed out.
printf('%.1f MB', memory_get_peak_usage(true) / 1048576);