Freeing Memory
Each time you create a variable, system memory is set aside for it. Although there is a limit to the memory available to any computer, you will rarely need to consider conserving its use when programming in PHP. Your scripts are likely to use very small amounts of data. And when your script finishes, the memory needed for variables is freed for use by other processes.
I am simplifying the process somewhat. There are some ways in PHP to create memory that persists longer than a single page load, and in modern operating systems physical memory does not match one-for-one with a program's view of available memory. In most cases you will be doing fine to consider that memory is a finite but abundant resource.
If you do run into memory ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access