ollie007 Posted June 11, 2009 Share Posted June 11, 2009 function name($var=''){} is that how its done/ Link to comment https://forums.phpfreaks.com/topic/161782-how-to-declare-default-values-for-function/ Share on other sites More sharing options...
trq Posted June 11, 2009 Share Posted June 11, 2009 Try the function manual. Link to comment https://forums.phpfreaks.com/topic/161782-how-to-declare-default-values-for-function/#findComment-853619 Share on other sites More sharing options...
ollie007 Posted June 11, 2009 Author Share Posted June 11, 2009 you aint being very helpful ! Link to comment https://forums.phpfreaks.com/topic/161782-how-to-declare-default-values-for-function/#findComment-853631 Share on other sites More sharing options...
haku Posted June 11, 2009 Share Posted June 11, 2009 function example_function($var1 = 'one', $var2 = 2) { // do function stuff here } This will set a default value of 'one' for $var1, and '2' for $var2, if they aren't set in the function call. Link to comment https://forums.phpfreaks.com/topic/161782-how-to-declare-default-values-for-function/#findComment-853653 Share on other sites More sharing options...
trq Posted June 11, 2009 Share Posted June 11, 2009 you aint being very helpful ! What exactly do you mean? Every question you have asked in the last few days is covered in detail in the manual. Same with this one. Learn to read it. Link to comment https://forums.phpfreaks.com/topic/161782-how-to-declare-default-values-for-function/#findComment-853661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.