function test($arg1, $arg2, $arg3 = "")
{
   if(isset($arg3))
   {
      // do whatever with $arg3 
   }
}

-----Original Message-----
From: Jonathan Villa [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 7:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] How to make an argument optional...confirmation...

I want to create a function with an optional argument/parameter but have
never read a concrete answer on how to do it.

This is what I am assuming

function test(arg1,arg2,arg3 = null)
{
        arg3 will be optional
}

is this correct?


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



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

Reply via email to