Re: PHP_Compat, signature changes
| From: | Philippe Jausions | Date: | Sat, 28 May 2005 18:08:42 +0000 |
| Subject: | Re: PHP_Compat, signature changes | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-37856@lists.php.net to get a copy of this message | ||
Daniel Convissor wrote:
Hey Aidan: On Sun, May 29, 2005 at 12:39:20AM +1000, Aidan Lister wrote:Daniel, The point is for existing functions that evolve over different versions of PHP. You want to make the latest signature of a function available to all previous PHP versions, whether or not that function is already built-in. Aidan, I wouldn't recommend going with the underscore _microtime(), seems risky for the future. I like: PHP_Compat_Component::microtime() and php_compat_microtime(). Could we make them work hand in hand? -PhilippeThere are a number of functions for which the function signature has changed. For example, microtime now has an added boolean, mkdir has a recursive switch, etc.If they're new, optional arguments at the end of the list, you can use func_get_args() to deal with them on an optional basis. <?php function foo($one) {$args = func_get_args(); echo "one = $one\n"; if (count($args) > 1) { echo "two = $args[1]\n"; }} foo(1, 2); ?>