Philip Arndt wrote:
> Hi,
> 
> Has anybody had any experience with writing a function that takes an  
> optional parameter (a parameter with a default value) that is a  
> complex object? Can this be done or is it just primitive types?

> And yes, I am aware that the PHP manual page says scalar values.. ( 
> http://nz.php.net/manual/en/functions.arguments.php 
>   ) but I wondered whether anybody has achieved what I am after :-)

You can always do

function f ( $args = null ) {

        if($args == null) {
                $args = new Whatever();
        }

        ...

}

-- 
Tim Oliver
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to