> I just read an interesting article in The Perl Journal (TPJ) about using > AUTOLOAD as a layer of abstraction for accessing database columns and I > would like to write something similar in PHP. Is this possible? > > I have written a number of PHP/MySQL applications, but do not consider > myself an expert. I cannot find anything on various PHP-related > websites and was hoping someone with more in depth knowledge would be > able to make a few suggestions.
Okay, so if I understand it correctly, you'd try to call a method such as $class->method() where method() doesn't actually exist. You'd want to catch that error, look for a column named 'method' in a table, and either set, return, or do both for the value in the column? If you call an unknown function, it produces a fatal error, so I don't think that can be trapped by set_error_handler and acted on. In order to do this, I think you'd have to do something like $class->method("phone","555-1212"); method() will look for a "phone" function and call it if it exists. Otherwise, look for a "phone" column and set/retrieve the value... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php