Re: Function definition: how to make default argument an empty array?

From: Date: Sat, 22 Dec 2001 20:27:42 +0000
Subject: Re: Function definition: how to make default argument an empty array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-78589@lists.php.net to get a copy of this message
At 01:17 PM 12/22/2001 +0100, Michael Jurgens wrote:
I'm now looking for a way to have the second (optional) argument be an array of strings. I can't get it to work though... In pseudo-code: function makeyogurt ($flavour, $type = 'EMPTY ARRAY') { }
Does this work? function makeyogurt ($flavour, $type = "") {
        $type = (array) $type;
        ...
} or function makeyogurt ($flavour, $type = "") {
        settype ($type, "array");
        ...
} ??

« previous php.general (#78589) next »