Naming conventions in PHP
I recently came across a dialog at work where two experienced PHP developers analyze class and function naming in PHP 4.3.x. The dialog begins with the question, “Is it acceptable to name a class Null in PHP”? You may ask - why would I care? Or, why is this an issue? It’s not really, in fact the best way to avoid problems with naming is to avoid keywords as class for function names. However, if you really need that flexibility, this dialog should be of use.
So what is empty() ?
it is not a function? In a class, it becomes a class method, not a language function. If you typed, just empty, it could also be a defined string. As, I said, it is the language parsing.
ahh.. php
From: Griggs Domler
Anything on this list:
http://us.php.net/tokens
Shouldn’t work as a class/function name (well, the ones present in version 4 anyway.)
From:
Empty, include (even though it is a construct) are functions. The language expects a parenthesis following those keywords. You could have a class called “false”, and it should work. As you said, it is just related to the language parsing, and well, language interpreter itself.
ahh, PHP.
From: Griggs Domler
From:
<?php
function hello() {
echo “hello\n”;
}
}
$myNull->hello();
?>