why use camelCase naming convention when php defaults don't use it?

Discussion in 'PHP' started by nekowai, Apr 27, 2017.

  1. #1
    I see many software using camelCase for class methods: $this->classMethod();
    But when they have to use a php's default method, it's for example : $resource->fetch_array(); (Not $resource->fetchArray())

    Why use two different name conventions? Why not stick with the defaults?
     
    nekowai, Apr 27, 2017 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    There is no "default" for PHP. PHP is a random mashup of every conceivable naming-convention you can think of (and probably some you can't), so use whatever you think is best. One argument FOR using camelcase is that then you won't possible clash with already established built-in function-names (but, again, this is no guarantee).
     
    PoPSiCLe, Apr 27, 2017 IP
    sarahk likes this.
  3. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #3
    So you don't end up mixing the two and can differentiate between php defaults and written by a coder.
    Naming conventions are just for redability purposes. Makes your code more readable. Its not a parsing rule or something...
     
    JEET, Apr 27, 2017 IP