An invaluable function is memory_get_usage. This function returns the amount of memory your script is being used.
As an example check how much memory giving a value to a variable will use:
//start memory $mem_start = memory_get_usage(); $s = "This is a test variable."; //end memory $mem_end = memory_get_usage(); //total used $used = $mem_end - $mem_used; echo $used;
You can use this to check if there are any potential memory problems with your script.