At 17:04 08.11.2002, Tim Molendijk spoke out and said:
--------------------[snip]--------------------
>Yes I know it is poor programming habits to do like I did... But I have a
>reason for it. I have quite a lot methods that accept objects *optional*. So
>f.e.:
>---
>class Product
>{
>    var $language;
>    function Product($language = FALSE)
>    {
>        $this->language = $language;
>    }
>}
>---
>Now to make this possible it becomes impossible to do what you suggest:
>function Product(&$language = FALSE)
>is not allowed. And in my application this optional arguments functionality
>is very important. So I have preferred this over the decent habit.
--------------------[snip]-------------------- 

You might always simply omit the parameter when calling the function
(you'll get a notice about that if enabled). You just cannot pass constants:

function Product(&$language)
{
   ...
}

// ok, but gives a notice
Product();

// will fail
Product('ger');

If you keep your code like it is be warned that it may break with a future
version of PHP.


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
    ^ http://www.vogelsinger.at/

Reply via email to