I am writing a script, where I need to set memory limit to something very high at a certain point. But, I need to restore memory limit after that.
But, ini_get returns -1 if your script has not called ini_set to set memory limit.
I am trying to do something like this :
$oldLimit = ini_get("memory_limit");
ini_set("memory_limit", "220M");
do something
//restore memory
ini_set("memory_limit", -1);
But, $oldLimit is -1.
what does -1 means in this scenario.
Thanks in advance.
-1 means unlimited, or in other words, you are limited by the server's physical memory. So there is no point in setting the memory_limit to something high