O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required