[Pugged] Function variable question

Angie Tollerson ciapug@ciapug.org
Fri, 22 Nov 2002 16:30:14 -0600


chris, this might help too, it's a slight variation of what Laith sent
you but is the way it's more commonly used
function getfunky( $var1, $var2, $var3  = ""){
  if(!empty($var3){
   do whatever
  }
}
That's probably the practicality that most people would use. IF $var3
ends up having a value the null will get overridden just fine. 

Angie Tollerson
Alliance Technologies Web Programmer
(515) 245-7628
tollerson@alliancetechnologies.net
>>> laith@prestonfam.org 11/22/02 11:41 AM >>>
At 10:29 AM 11/22/2002, you wrote:
>function getfunky($var1, $var2, $var3){
>   // how to get funky
>}
>
>Q: $var3 is something that may not get used every time I use this 
>function. I am curious how to make this variable optional?

function getfunky( $var1, $var2, $var3  = "*NOTUSED*"){
         //how to get funky
                 // with code to ignore $var3 if == *NOTUSED*
}

or
function getfunky( $var1, $var2, $var3  = default){
         //how to get funky
                 // where default == a default value
}

that ZEND thing was confusing to me...

Laith

_______________________________________________
Ciapug mailing list
Ciapug@ciapug.org
http://cialug.org/mailman/listinfo/ciapug