On Wed, 21 Jul 2004 13:39:32 -0500, Alex Hogan
<[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> How do I write a function with optional arguments?  Is it possible in
> php?
> 
> function myfunc($First, $Second,[$Third, $Fourth]){
>     some stuff here
> }
> 

Give them a default value and they become optional

function myfunc($First, $Second,$Third = 'something', $Fourth = 'something'){
    some stuff here
}

If you want them empty, you can use $Third = '' or $Third = null
depending on what you need.

P.S. *WHY* do you include that outrageous footer? It serves absolutely
no purpose.

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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

Reply via email to