# Runtime-Extension of Classes

- Thread: https://externals.io/message/50537
- Original archive: https://news-web.php.net/php.internals/50537
- Started by Kenan Sulayman on 2010-11-25T15:44:20+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #50537 — Kenan Sulayman — 2010-11-25T15:44:20+00:00

URL: https://externals.io/message/50537#50537

Hello out there!

This morning I asked myself whether it's possible to extend a class without
calling the child, but the initially extended class?
It can, in some circumstances, really be important.
I.e.: I build an CLI-shell interface for some back-end stuff I'd to do - and
it really is a pain in the ass to do all of the include-register-calls' for
each of a newly written extension. It could be so much easier, considered
having a possibility to do the include-[I'm usable] way ;)

I mean, for instance:

<?
interface XorePwnI {
public function XorePwn ( $_uu, $_xw );
 /*
...
*/
 }
 class XorePwn implements XorePwnI {
 public function XorePwn ( $_uu, $_xw ) {
return true;
}
 }
 class XorePwn_Intruder extends XorePwn {
 public function CorePwn ( $_uu, $_xw ) {
return *$this->XorePwn( $_uu, $_xw ) ;* // obviously, that's not possible,
but a demo
 }
}
?>

So - is there a way to dynamically extend a class (not the traditionally
"get-the-class,-clone-the-class-and-add-sugar"-way) ?

I'd really like to hear some cool explanations - but, well, please don't
tell me that's not possible, because it's not possible.. ;)

So, cheers guys,
--
(c) *Kenan Sulayman*
*Freelance Designer and Programmer*

*Life's Live Poetry*

-- *Notice *--
The validity of none of any of the text in this mail is guaranteed. The
information in this message is confidential and may be legally privileged.
 It is intended solely for the addressee. Access to this message by anyone
else is unauthorized.  If you are not the intended recipient,  any
disclosure,  copying or distribution of the message,  or any action taken by
you in reliance on it,  is prohibited and may be unlawful.  If you have
received this message in error,  please delete it and contact the sender
immediately.  Thank you.

---

## #50538 — johannes@schlueters.de — 2010-11-25T15:58:49+00:00

URL: https://externals.io/message/50537#50538 · In reply to: #50537

> So - is there a way to dynamically extend a class (not the
> traditionally
> "get-the-class,-clone-the-class-and-add-sugar"-way) ?

After reading this three times i interpret it like "I want to add stuff
to the instance" and no that is not possible (runkit doesn't count) by
the definition of our class-based OO model.

> --

that should be "-- " mind the space.

> -- *Notice *--
> The validity of none of any of the text in this mail is guaranteed.
> The
> information in this message is confidential and may be legally
> privileged.
>  It is intended solely for the addressee. Access to this message by
> anyone
> else is unauthorized.  If you are not the intended recipient,  any
> disclosure,  copying or distribution of the message,  or any action
> taken by
[..]

sorry. I just broke the rule as the addressee is the list, not me.
Please get rid of this when sending the next mail to this list.

johannes

---

## #50540 — Kenan Sulayman — 2010-11-25T16:08:44+00:00

URL: https://externals.io/message/50537#50540 · In reply to: #50538

Okay. :/

After all, thank you for the interjection of "Runkit" ^^
I think, I'll give it a try.. :)

Thanks - and uhh - my signature really looks ugly in the mailing-list.
Thanks for letting me know ;)

Cheers,
-- 
(c) *Kenan Sulayman*
*Freelance Designer and Programmer*

*Life's Live Poetry*

2010/11/25 Johannes Schlüter <johannes@schlueters.de>

> class-based OO
