jaymc Posted November 22, 2008 Share Posted November 22, 2008 Lets say I have a function set out like this function beans($a,$b) { // DO STUFF } I have used this 100's of times in various scripts.. however, I now need to change this function to look like function beans($a,$b,$c) { // DO STUFF } Is there a way to call the function like beans($a,$b) or beans($a,$b,$c) so that if $c is not used it is simple ignored, as apposed to javascript giving an error I do not want to change all occurances of this function if I do not have to Thank you! Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 22, 2008 Author Share Posted November 22, 2008 PHP does it like this function myFunction($mandatory_argument,$optional_argument = 1) { /* ...Whatever... */ } 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.