RPMiSO Posted January 21, 2010 Share Posted January 21, 2010 How can I create optional arguments? Lets say I have: function getPost($id,$category,$username){ //some code to execute } Now when I call getPost with just $id I'm going to get some warnings about missing arguments. How can I get around this? Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted January 21, 2010 Share Posted January 21, 2010 function getPost($id,$category,$username = 'foo'){ //some code to execute } 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.