Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing PHP5 to be case-sensitive.

Status
Not open for further replies.

karnaf

Programmer
Nov 16, 2002
41
IL
Quoting from Zend newletter from May 7, 2001
Since PHP 2, the language has always regarded variable names to be case sensitive, while functions and classes are not. It appears that either PHP 4.1 or PHP 5 will break compatibility with this previous functionality, and regard everything as case sensitive.

As it looks to me, PHP5 is still case insensitive when it comes to functions and classes.

Does anyone know if there is a way to force PHP5 to be case sensitive? so that if I have

Code:
class Foo() {
  function Goo() {
    print ("Hello world!");
  }
}

$FooInstance = new Foo;
$FooInstance->Goo(); // Will work great
$FooInstance->goo(); // Should return a parse error

I want to have a stricter coding for the project I work on :)

thanks!
 
Sure. Get the source-code, rewrite PHP to suit your requirements, and use the changed version.

I think that if you want stricter coding for the project you're working on, the place to start enforcing standards is not the language but the programmer.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
come on! [evil] it doesn't answer my question at all. I hope you meant to be funny.


I'll keep it simple -
Is there or isn't there a way to make PHP5 parser case-sensitive?
 
No, I am not being funny. To the best of my knowledge, there is no runtime setting which will make PHP case-sensitive in the names of functions and classes. Thus, the only way to make it so would be to hack the source code for the language engine. PHP is open-source, so this is indeed possible.


My comment about the best place for enforcing coding standards was not in jest, either. Depending on the B&D features of a language is not a good way to enforce a coding standard.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top