drtanz Posted January 28, 2010 Share Posted January 28, 2010 I am trying to decide on using a naming convention for my functions, I've read that zend recommends camelCase but I've also come across alot of PHP functions named like so: function my_function($args) { } Which is best? Quote Link to comment Share on other sites More sharing options...
salathe Posted January 28, 2010 Share Posted January 28, 2010 Any, so long as it is clear (like camelCase and under_scored), descriptive and consistent throughout your code. Quote Link to comment Share on other sites More sharing options...
gwolgamott Posted January 28, 2010 Share Posted January 28, 2010 As salathe said as long as it is clear. Depends on your audience too. I prefer underscores, just because I can pick them out quickly is all though. Then again I tend to try to make it look cleaner at times with using underscores for variables and then camelCode for my functions, especially if intended for someone else to look at my code just to make it easier to read. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 CheckInput() CheckVars() CheckCheck() Just gets old to me. Underscores are great for pseudo-catagorization check_input_length() check_input_parameters() session_set() session_remove() display_integer() dispay_formatted() Quote Link to comment Share on other sites More sharing options...
drtanz Posted January 28, 2010 Author Share Posted January 28, 2010 Ared dashes used regularly too or are underscores preferred? Quote Link to comment Share on other sites More sharing options...
Adam Posted January 28, 2010 Share Posted January 28, 2010 Dashes are invalid characters in function/variable names. 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.