I made a simple class that provides a simple SQLite-based persistant FIFO stack class for PHP 5 (similar conceptually to Stack::Persistent in Perl).
A number of times I've written Drupal scripts that run out of memory while trying to process large amounts of nodes (changing taxonomy, etc.). Adding them to a persistant stack, then doing them in batches, is an easy way to remedy this.
Example usage:

