Re: Function with Optional Arguments

From: Date: Wed, 21 Jul 2004 19:17:20 +0000
Subject: Re: Function with Optional Arguments
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-191383@lists.php.net to get a copy of this message
On Wed, 21 Jul 2004 13:39:32 -0500, Alex Hogan <alex.hogan@alliedelec.com> 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--

« previous php.general (#191383) next »