Jump to content

Setting options when creating functions....?


DamienRoche

Recommended Posts

Ok, I'm not sure what I'm thinking here. Just bare with me.

 

I have seen something similar to this before:

 

function somefunc($var, $var | BLAH = TRUE){

 

 

}

 

...or something along those lines. What is the blah = true called? (func option?).

 

Another thing, I would like to define a certain state in my function, but I need this state to be optional - as in I don't always have to declare it.

 

Like:

 

function somefunc($var1, $var2){

 

}

 

but what if I do this:

 

somefunc("hiii");

 

- doesn't work because I have to define both vars...is there a solution to this?

 

----NOTE: none of this is to solve a problem I am having, I simply want to increase some of skills with classes and functions.

 

Welcome any help. Thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/146099-setting-options-when-creating-functions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.