aleksanteri Posted June 22, 2006 Share Posted June 22, 2006 Just was thinking what other members have as their keyword/function habit.I do use lowercase letters for both keywords and functions. Link to comment Share on other sites More sharing options...
skym Posted June 22, 2006 Share Posted June 22, 2006 I use both upper and lowercase for custom function/class names like: myFunction()Variables, always lowercase: $my_variableConstants, always uppercase: MY_CONSTANTKeywords/built-in functions, always lowercase. Link to comment Share on other sites More sharing options...
scott100 Posted June 22, 2006 Share Posted June 22, 2006 Functions and variables are first word lower other words start with a capitalgoToShops()$buySomeBreadbuilt in function lower casemysql_connect() Link to comment Share on other sites More sharing options...
aspnetguy Posted June 22, 2006 Share Posted June 22, 2006 I usually use all CAPS for constants int NUM = 5;int[,] gameBoard = new int[NUM,NUM]; Link to comment Share on other sites More sharing options...
ThePsion5 Posted June 22, 2006 Share Posted June 22, 2006 All of my coding is Java style: function noSpacesButCaps() { ... }var $sameForVariables;constant LIKE_FINAL_VARS; It usually works very well for me, anyway. Link to comment Share on other sites More sharing options...
aleksanteri Posted June 22, 2006 Author Share Posted June 22, 2006 (edited) Yeah, for constants though I use uppercase.- variables lowercase $myvar; $anothervar - functions (including built-in) lowercase checkpass(); print(); - constants uppercase (as I mentioned above) define("TEN_BY_TEN", (10*10)); $hundred = TEN_BY_TEN; - keywords lowercase if($x == 5) print("\$x is 5"); - operators if in letters copy($file, $dir) or print("Couldn't copy $file"); if($x == 5 and $y == 5) print("Both \$x and \$y are 5"); I also have a habit of having print() having parenthenses. I never use echo but if I would it wouldn't have semicolons as PHP Group wrote in their manual that echo is more a statement instead of a function and print is more a function instead of a statement. My habit has all functions having parenthenses and statements have only if required. Edited June 23, 2006 by aleksanteri Link to comment Share on other sites More sharing options...
justsomeguy Posted June 22, 2006 Share Posted June 22, 2006 The only thing I use uppercase for is constants. Everything else is lowercase, if I have an identifier that is more than one word I separate them with underscores. I also have a habit of having print() having semicolons.I think you mean parentheses. All statements are terminated by a semicolon (. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now