<p>What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP</p>

<pre><code>&lt;?php
  $class_name = 'SomeClassName';
  $object = new $class_name;
?&gt;
</code></pre>

<p>This is a contrived example, but I've seen this form used in Factories (OOP) to avoid having a big if/switch statement.</p>

<p>Problems that come immediately to mind are    </p>

<ol>
<li><s>You lose the ability to pass arguments into a constructor</s> (LIES. Thanks Jeremy)</li>
<li>Smells like eval(), with all the security concerns it brings to the table (but not necessarily the performance concerns?)</li>
</ol>

<p>What other implications are there, or what search engine terms other than "Rank PHP Hackery" can someone use to research this?</p>

It looks you can still pass arguments to the constructor, here's my test code:
```
```
<?php

class Test {
    function __construct($x) {
        echo $x;
    }
}

$class = 'Test';
$object = new $class('test'); // echoes "test"

?>
```
```
That is what you meant, right?
So the only other problem you mentioned and that I can think of is the security of it, but it shouldn't be too difficult to make it secure, and it's obviously a lot more secure than using eval().