-
Memory allocation using in PHP
In PHP there are many ways to allocate the memory but using the function memory_get_usage(), we can allocate the memory to the string as follows.
memory_get_usage — Returns the amount of memory allocated to PHP
Description : int memory_get_usage ( void )
Returns the amount of memory, in bytes, that’s currently being allocated to your PHP script.
memory_get_usage() will only be defined if your PHP is compiled with the –enable-memory-limit configuration option.
View Code PHP1
if you want to change limit of memory uses by script than find memory_limit in your php.ini file and change it.
We can use the memory in bytes, kilobytes and megabytes.