WolfRage Posted July 18, 2009 Share Posted July 18, 2009 This may be an easy one, but I don't know the answer. I want to create some custom functions and I want to have them sometimes accept variables but other times if no variables are provided to fall back on defaults. I understand how to check whether or not the variables were provided, but it is the matter of not generating a PHP warning when the variables are not provided. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted July 18, 2009 Share Posted July 18, 2009 you mean like this ? function test($v = "default") { //do stuff return $v; } echo test(); echo test("testing"); Quote Link to comment Share on other sites More sharing options...
WolfRage Posted July 18, 2009 Author Share Posted July 18, 2009 So it was easy, guess I never picked up on that before. Thanks! Now I can do what I have been trying to work around. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted July 18, 2009 Share Posted July 18, 2009 if($solved == true) { echo "Can you click solved bottom left please"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.