You are here: Re: [PHP] Object Inheritance, get_class() and a static function call « PHP « IT news, forums, messages
Re: [PHP] Object Inheritance, get_class() and a static function call

Posted by axel on 11/14/09 11:22

Hello Jochem,

> Axel lets start again.


Okay.

> SO: explain, please, why and what you are trying to do (DETAILS!).
> don't dumb it down because that just makes the problem look moot.



I need the classname to register variables in the session. It's
complicated. There are a lot of inheritences. Please take a look at the
code:


class onObject {
// ... }


abstract class onAplObject extends onObject {

protected static function registerVariable($key, $value) {

$theRealClassName = ???;

# $theRealClassName = get_class($this);
# output is --> Undefined variable: this in ...

# $theRealClassName = get_class(self);
# output is --> Notice: Use of undefined constant self ...

# $theRealClassName = __CLASS__; # =>
$theRealClassName=="onAplObject"

# $theRealClassName = debug_backtrace()[1]['class'];
# => $theRealClassName=="onDbTableEdit"

# $theRealClassName = debug_backtrace()[0]['class'];
# => $theRealClassName=="onAplObject"

$_SESSION[$theRealClassName.'_'.$key]=$value;
}
}

class onDbTableEdit extends onAplObject { public static function show() {
self::registerVariable("listsort", "id");
}
}

class onUseradmin extends onDbTableEdit {
// ....
}

onUseradmin::show();


Best regards
Axel

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация