2 Replies - 359 Views - Last Post: 02 November 2013 - 12:37 PM Rate Topic: -----

#1 AnalyticLunatic  Icon User is offline

  • D.I.C Lover

Reputation: 221
  • View blog
  • Posts: 1,030
  • Joined: 25-June 12

Why are some parts of PHP case-sensitive when others are not?

Posted 02 November 2013 - 12:21 PM

I don't have a lot of experience with PHP, so I was wondering if one of the Experts here could explain to me why some parts of PHP are case-sensitive when others are not?
Is This A Good Question/Topic? 0
  • +

Replies To: Why are some parts of PHP case-sensitive when others are not?

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3473
  • View blog
  • Posts: 11,788
  • Joined: 12-December 12

Re: Why are some parts of PHP case-sensitive when others are not?

Posted 02 November 2013 - 12:34 PM

There is an SO discussion here which seems to suggest that the decision was almost arbitrary.

I always assume everything is case-sensitive, but this doesn't help me when the docs themselves switch between different casing for method-names :whistling:

Posted Image
from here
Was This Post Helpful? 1
  • +
  • -

#3 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Re: Why are some parts of PHP case-sensitive when others are not?

Posted 02 November 2013 - 12:37 PM

To confuse the newbies; to keep them on their toes. Consistency in language syntax breeds week minded coders!

No, seriously. It's essentially pretty simple. Variable names and constants are case sensitive, function and class names are not. Beyond that, I can't remember any edge cases of the top of my head. (There probably are though.)

Best thing is to just assume everything is case-sensitive and code according to that. Pick a syntax style and stick to it.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1