#48055 [NEW]: Creating class instances by using a variable as class name

From: Date: Wed, 22 Apr 2009 21:51:03 +0000
Subject: #48055 [NEW]: Creating class instances by using a variable as class name
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2152@lists.php.net to get a copy of this message
From: momrom at freenet dot de Operating system: - PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Creating class instances by using a variable as class name Description: ------------ Its possible to create a new instance of a class by using a variable as class name. But the only place where I read something about this was the first example on page 'OO5 - Patterns'. I think there should be a note about it in paragraph 'new' on page 'OO5 - The Basics'. Expected result: ---------------- It is possible to use a variable as classname when creating new instances. <?php $classname = 'MyClass'; $instance = new $classname; ?> -- Edit bug report at http://bugs.php.net/?id=48055&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48055&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48055&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48055&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48055&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48055&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48055&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48055&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48055&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48055&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48055&r=support Expected behavior: http://bugs.php.net/fix.php?id=48055&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48055&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48055&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48055&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48055&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48055&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48055&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48055&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48055&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48055&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48055&r=mysqlcfg

« previous php.doc.bugs (#2152) next »