DamienRoche Posted February 20, 2009 Share Posted February 20, 2009 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 More sharing options...
farkewie Posted February 20, 2009 Share Posted February 20, 2009 Second question... <?php function meFunky($forcedVar, $optionalVar = null){ echo "Lets get ". $forcedVar; } meFunky("Funky") ?> Link to comment https://forums.phpfreaks.com/topic/146099-setting-options-when-creating-functions/#findComment-766977 Share on other sites More sharing options...
DamienRoche Posted February 20, 2009 Author Share Posted February 20, 2009 Thanks, one step closer. Not sure where I saw that crazy syntax I spewed up there...guess I'll have to keep searching. Thanks again. Link to comment https://forums.phpfreaks.com/topic/146099-setting-options-when-creating-functions/#findComment-766986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.