Which of the following PHP functions can be used to get the current memory usage?

A memory_get_usage()
B memory_get_peak_usage()
C get_peak_usage()
D get_usage()

Correct Answer: memory_get_usage()

memory_get_usage() returns the amount of memory, in bytes, that’s currently being allocated to the PHP script. We can set the parameter ‘real_usage’ to TRUE to get total memory allocated from system, including unused pages. If it is not set or FALSE then only the used memory is reported. To get the highest amount of memory used at any point, we can use the memory_get_peak_usage() function.

Related Questions

What function can you use to create your own streams using the PHP stream wrappers and register them within PHP?
Say I want to change the extension of a PHP file, which of the following statements should I edit to change from .php to .html in the httpd.conf file?
Which one of the following preg PHP functions is used to take a string, and put it in an array?
What can be done to monitor the memory usage?

Next steps