voidstate Posted November 29, 2007 Share Posted November 29, 2007 Is it possible to have a variable number of parameters passed to a method? function myMethod( $a, $b ) { // i want to check for $c, $d, $e, etc... here } Cheers voidstate Quote Link to comment Share on other sites More sharing options...
adam291086 Posted November 29, 2007 Share Posted November 29, 2007 i dont think so, you set the function up to do the checking. Then you call on the function to check the variables later on. I think i am right but not 100% sure Quote Link to comment Share on other sites More sharing options...
Orio Posted November 29, 2007 Share Posted November 29, 2007 You can have functions that deal with different amount of variables, it's not too hard to do that either. Check the "Variable-length argument lists" section in here, it will tell you what functions you need to use: http://www.php.net/manual/en/functions.arguments.php But I think it's easier to store all of the data in an array and pass that array. You can do much more when it's in an array. Orio. 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.