php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12819 variables and constants in classnames
Submitted: 2001-08-17 16:45 UTC Modified: 2003-05-31 10:46 UTC
From: giancarlo at navigare dot net Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0.6 OS: any
Private report: No CVE-ID: None
 [2001-08-17 16:45 UTC] giancarlo at navigare dot net
it would be nice to have the possibility to create classes with variable or constants in 'classname' and 'extends'.

eg:
define $myauth="myAuth";
define ("_BASE_AUTH_CLASS", "Base_Auth");

class {$myauth} extends {_BASE_AUTH_CLASS}
  {...
etc

This way package delivery and integration would be a lot easier, as they can presume the existance of already defined classes, and adopt them.


Giancarlo

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-31 10:46 UTC] andrey@php.net
Good architecting of the application and you will never run into such problems. Look into PEAR to see how they solved this or just prepend you class names with something specific to you (or your company).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 10:01:29 2025 UTC