Re: Re: [PHP4BETA] Bug: Isn´t it possible to use req uire /include to add methods to classes????
| From: | Faisal Nasim | Date: | Fri, 12 May 2000 11:08:40 +0000 |
| Subject: | Re: Re: [PHP4BETA] Bug: Isn´t it possible to use req uire /include to add methods to classes???? | ||
| References: | 1 2 3 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14899@lists.php.net to get a copy of this message | ||
| I dit not know that it is not possible to require inside classes outside
methods.
| Disallowing include() would make sense, but why don´t allow require.
| What if you need a set of functions in many classes, of course I could
I would rather say that its an intelligent idea not to allow
include()/require()
there. And as for multiple functions in same classes is considered, it makes
absolutely no sense for having multiple functions which do the same thing.
| put that function in another class and let the one extend the other, but
| multiple extends aren´t suported in php and if I need another extension
| I´ll have to modify the whole code and to keep my functions all
| together. I can´t call it from outside because of another issue I´ve
| posted, that variable references aren´t supported for variable functions.
Why don't you simply make a class 'myfunctions' which all other classes
could use without any inheritence ('extend')?
| And before using eval() I´ll cut&paste the code in every class.
|
| Am I wrong or could this be a nice extensions. Another function which
| works like require() before the whole script is parsed replacing itselft
| entirely with another file....
You're overlooking the concept of a class. I don't know, but doesn't
make much sense to me.
Faisal