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? Link to comment https://forums.phpfreaks.com/topic/189372-optional-arguments-in-a-function/ 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 } Link to comment https://forums.phpfreaks.com/topic/189372-optional-arguments-in-a-function/#findComment-999645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.