You can store your data into:
- Databases
- Caches (e.g. memcached)
- Files (not really recommended, you should prefer databases)
What exactly is your usecase? For persistent data storage you should use a database, for some temporary things caches (as long as you need no guarantee that the data will not be deleted sometime).
For storing anonymous functions you have to serialize them first. To do so, see https://github.com/jeremeamia/super_closure or http://www.htmlist.com/development/extending-php-5-3-closures-with-serialization-and-reflection/