function aliases

From: Martijn (subscription-remove-101_at_hot-remove-mail.com)
Date: 03/30/05


Date: Wed, 30 Mar 2005 13:05:05 +0200

Hi,

I have to write a dynamic page which has to run on several platforms, using
different databases. Because of that, I want to write a small db-front-end
which is an almost 1-on-1 mapping of the functions provided by the PHP API
(and the proper front-end is loaded using a conditional include).

Using the "C-way", I thought of using define(), but in PHP that can only be
used for defining constants. I also though of using function variables, but
then the feel of the code changes.

The simplest method I have found sofar is the following (for mysql_connect):

        function sql_connect()
        {
                $p = func_get_args();
                return ( call_user_func_array('mysql_connect', $p) );
        }

Anybody got any other ideas?

Thanks,

-- 
Martijn
http://www.sereneconcepts.nl