Instantiate a class in a case-insensitive way <p>I'm faced with a bit of an issue. I have my class name in a variable and I need to instantiate it, but I have no way of knowing that my variable has the exact same case than the class.</p> <p>Example:</p> <pre><code>//The class I'm fetching is named "App_Utils_MyClass" $var = "myclass"; $className = "App_Utils_".$var; $obj = new $className(); </code></pre> <p>How can I make this work?</p> <p>Additional info:</p> <ul> <li>I have a <code>class_exists()</code> check (case insensitive) before this snippet to make sure that the class I want actually exists.</li> <li>The class name is always properly camel-cased (e.g. <code>MySuperAwesomeClass</code>).</li> </ul>