KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP <?php $class_name = 'SomeClassName'; $object = new $class_name; ?> This is a contrived example, but I've seen this form used in Factories (OOP) to avoid having a big if/switch statement. Problems that come immediately to mind are You lose the ability to pass arguments into a constructor (LIES. Thanks Jeremy) Smells like eval(), with all the security concerns it brings to the table (but not necessarily the performance concerns?) What other implications are there, or what search engine terms other than "Rank PHP Hackery" can someone use to research this?
Tags (comma-separated)
Save Edits
Cancel