Summary:
* in PHP 5.1 class names have case preserved
* contrary, in PHP 4.4 class names are downcased, withe exception of a few build-in ones
The get_declared_classes() funcition returns the list of names with case preserved, as of PHP 5.1 series (prolly 5.0 too, but i have no way to test it right now). Since PHP generally is caseless in regard to names of classes, this may come at a surprise. Also, this could potentially break older code asssuming downcased list.
Take extra care when checking for existence of a class. Following example is, potentially, error prone: <?php in_array( $className, $classget_declared_classes() ) ?>
A sure-fire (while slower) way would be to iterate over the array and normalize case to, say, lower:
<?php
$exists = FALSE;
$className = strtolower( $className );
foreach ( get_declared_classes() as $c ) {
if ( $className === strtolower( $c ) ) {
$exists = TRUE;
break;
}
}?>
Optimization of the above snippet is left as a simple excercise to the reader ;)
-- dexen deVries