Re: Re: [NEWBIE GUIDE] For the benefit of new members
| From: | Jason Barnett | Date: | Tue, 25 Jan 2005 22:48:56 +0000 |
| Subject: | Re: Re: [NEWBIE GUIDE] For the benefit of new members | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207302@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
The assignment was intentional... but the reason is that it's my generic trigger for any function / method. So that this can be used inside of incomplete functions as well as methods. <?php class test2 { static function test3() {Oh and by the way, whenever I'm creating the skeleton of a new class I will usually insert the following code snippet into the functions to let me know I have to come back and actually implement it later. if ($class = __CLASS__) { trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is not finished.', E_USER_WARNING); } else { trigger_error(__FUNCTION__ . ' is not finished.', E_USER_WARNING); }Why the assignment to $class? Is that supposed to be == or is it just allowing for static class/method calls with no object instantiated?
if (__CLASS__) {
trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is not finished.', E_USER_WARNING);
} else {
trigger_error(__FUNCTION__ . ' is not finished.', E_USER_WARNING);
}
}
}
function test() {
if (__CLASS__) {
trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is not finished.', E_USER_WARNING);} else {
trigger_error(__FUNCTION__ . ' is not finished.', E_USER_WARNING);} } test(); $t2 = new test2(); $t2->test3(); test2::test3(); ?>
And would not 'if (__CLASS__)' serve just as well?Good point... no need to assign to the variable; __CLASS__ alone is more efficient. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins