Are you comparing windows/mac to linux?
Assume the file Wooby\Dooby\Foo.php
exists. With the following contents:
<?php
namespace Wooby\Dooby;
class Foo {}
Class names are not case sensitive
If a class already exists, it doesn't matter what case you use to refer to it, the class will be found:
<?php
require "Wooby/Dooby/Foo.php";
echo "Class Wooby\\Dooby\\foo does " . (class_exists("Wooby\\Dooby\\foo") ? '' : "NOT") . " exist\n";
echo "Class wooby\\dooby\\foo does " . (class_exists("wooby\\dooby\\foo") ? '' : "NOT") . " exist\n";
echo "Class Wooby\\Dooby\\Foo does " . (class_exists("Wooby\\Dooby\\Foo") ? '' : "NOT") . " exist\n";
Running the above test file would return:
-> php index.php
Class Wooby\Dooby\foo does exist
Class wooby\dooby\foo does exist
Class Wooby\Dooby\Foo does exist
Filesystems are case sensitive
If a class does not exist and you use an autoloader - then case does matter. Consider the above example modified to use a simple autoloader:
<?php
ini_set('display_errors', 0);
function __autoload($name) {
$file = str_replace('\\', '/', $name) '.php';
if (file_exists($file)) {
include $file;
}
}
echo "Class Wooby\\Dooby\\foo does " . (class_exists("Wooby\\Dooby\\foo") ? '' : "NOT") . " exist\n";
echo "Class wooby\\dooby\\foo does " . (class_exists("wooby\\dooby\\foo") ? '' : "NOT") . " exist\n";
echo "Class Wooby\\Dooby\\Foo does " . (class_exists("Wooby\\Dooby\\Foo") ? '' : "NOT") . " exist\n";
The results would be:
-> php index.php
Class Wooby\Dooby\foo does NOT exist
Class wooby\dooby\foo does NOT exist
Class Wooby\Dooby\Foo does exist
Because the autoloader is looking for paths which match the missing classname, only the last entry triggers including a file and loading the class.
Unless you're using windows or a mac1 which both use case-insensitive file systems.
Summary
Class names in php are not case-sensitive, but your code likely is as it effectively inherits the case-sensitivity of the file-system. Obviously it's best to use consistent case and not rely on php correcting lazy development habits.
Note that class_exists has a parameter to turn on or off (on by default) the use of an autoloader when looking for none-existent classes.
Footnotes
1 More accurately HFS is, by default, case-insensitive but case-preserving.