[Phpmyadmin-devel] PHP3: $function()?

Rabus rabus at bugfixes.info
Tue Feb 4 22:13:02 CET 2003


-----Original Message-----
From: Garvin Hicking
>
> I today finished the JavaScript popup SQL query window (nice
> term ;-)

Hmm... How about SQL query JavaScript popup window? ;-)

> which works quite nicely. Think you will pretty much like it. :)
>

Great. Could you submit a patch to the patch tracker so we can test it?

> I now started on the mimetype-stuff and have a question for
> you who have php3-access:
>
> Is variable function calling possible in this version?
> Something like
> $queryfunction($string)?

Afaik this is possible in PHP3, but I'm not sure. But I think we have
already used this in our code.

>
> It's because I'm implementing something like a transformation-plugin
> directory. Every php file is a transformation on its own with
> a specific filename. Inside the file the function should be called
> like the filename, so I would like to do the following:
>
> 1. Find out the mimetype and transformation for a field
> 2. Search for the php-file which contains the transformation
> 3. Include that file
> 4. Because multiple plugins can be called on a single page, a single
> function name is not possible. So I now want to call the
> included function
> with $transformation($buffer, $options).
>
> I somehow guess, that this is not possible with PHP3? If you,
> can you as
> well check  if this leads to a parse error:
>
> if (str_replace('.', '', PHP_VERSION) > 403) {
>         $php4functiononly();
> }

My ISP uses both on the webservers: .php3 files are parsed with PHP3
whereas .php files are parsed with PHP4.
At about 14:00 (CET), I'll test this.

>
> If it does I would have to include this function call from
> another page, which will surely be a major performance hit
> for larger result sets. :-\

Or you'd have to build a wrapper function that passes the parameters to
the correct function.
Something like:

function my_wrapper($param) {
    global $whatfunctiontouse;
    switch ($whatfunctiontouse) {
        case 'foo':
            return foo($param);
        case 'bar':
            return bar($param);
        case 'foobar':
            return foobar($param);
    }
}

Alexander M. Turek
<alex at bugfixes.info>

+-----------------------------+
| The phpMyAdmin Project      |
| http://www.phpmyadmin.net   |
| rabus at users.sourceforge.net |
+-----------------------------+
| [bugfixes.info]             |
| http://www.bugfixes.info    |
| rabus at bugfixes.info         |
+-----------------------------+







More information about the Developers mailing list