Jump to content

keywords/functions


aleksanteri

Do you use uppercase letters or lowercase letters in keywords and/or in functions?  

10 members have voted

  1. 1. Do you use uppercase letters or lowercase letters in keywords and/or in functions?

    • Uppercase
      1
    • Lowercase
      5
    • Both uppercase and lowercase
      4


Recommended Posts

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

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

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 by aleksanteri
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...