#48055 [Opn->Csd]: Creating class instances by using a variable as class name
| From: | danbrown@php.net | Date: | Fri, 08 May 2009 13:40:49 +0000 |
| Subject: | #48055 [Opn->Csd]: Creating class instances by using a variable as class name | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2213@lists.php.net to get a copy of this message | ||
ID: 48055
Updated by: danbrown@php.net
Reported By: momrom at freenet dot de
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: -
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2009-04-22 21:51:02] momrom at freenet dot de
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 this bug report at http://bugs.php.net/?id=48055&edit=1