Insensitive names for classes
| From: | Marcus and Aviva and Rhiannon | Date: | Wed, 15 Aug 2001 23:43:24 +0000 |
| Subject: | Insensitive names for classes | ||
| Groups: | php.lang | ||
| Request: | Send a blank email to php-lang+get-193@lists.php.net to get a copy of this message | ||
Hi.
No, this is not a posting on not hurting the feelings of your
objects.
I use Java style class names...
class MyClass {
...
}
That is mixed case. This works fine until I register the class name
in some kind of list (e.g. for a singleton pattern). "MyClass" and
"myclass" are identical and get_class() returns the lower case
version for each.
This took me a few hours of head scratching to figure out as I was
using references heavily at the time and assumed that I was screwing
them up like everyone else.
This also caught me by surprise. I looked a little deeper and found
that this...
$fred = "Hello";
$FRED = "World";
echo $fred." ".$FRED;
...caused complete chaos.
I am using the OS/2 version of PHP. Does this carry over to the
Linux version or is it a porting issue?
If this is a bug, can we "fix" this or at least have it documented
under get_class(). It may be documented elsewhere, but I could not
find it.
yours, Marcus.
p.s. If people have already mentioned this I apologise, but my
bandwidth is rather low and downloading a month or two of messages
would have taken a while. Sorry to all if I am repeating known
stuff.
--
web:- http://www.appo.demon.co.uk
Marcus (mobile): nokia@appo.demon.co.uk
Marcus: marcus@mirrormill.com, ICQ:68231455
Aviva: aviva@appo.demon.co.uk