Re: function_exists question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matt Pagel wrote:
Is there a way to check not only if a function exists, but also to check that the number and types of parameters desired match a function definition?

The reason being that additional options have been added in php 4 and 5 to various standard function calls, but I'm still running a php3 and php4 server in addition to a php5 server. I would like to make sure that certain "extended" function calls still work in all versions (or I'll perform the tasks "manually", albeit less efficiently).

One example I can think of is the round() function. The $precision parameter was added in php4, so will not work in php3. However, function_exists would return TRUE for both 3 and 4, but round itself would fail if I tried to send a precision level to the php3 server.

Thanks much,
Matt

P.S. Of course the modified "function_exists" would unfortunately have to be a recognized function/method in php3 in order for me to call it to check parameter counts on a php3 server :(

I was going to say reflection but can't see that working in php 3/4, likewise with a try catch block to test..

worth noting as well that it appears function_exists itself isn't on PHP3 (tbh i think you can just not worry about php3.. but you'll know your specific needs yourself better)

a sure fire approach would be to write all you're own functions and literally avoid all internal functions :) [you'd sure as hell learn a lot in the process)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux