|
Posted by Erwin Moller on 11/14/05 11:34
alee.indy@gmail.com wrote:
> Basically, I want to add default methods to the PHP string object so
> that I can do something like:
>
> $stringvar = "hello";
>
> $stringvar -> append(" world"); // where append is some kind of
> prototyped function i define
>
> echo $stringvar; // "hello world"
>
> is this at all possible?
>
> thanks!!
Hi,
AFAIK you cannot easily extend the existing String in PHP.
(You would have to dive into the sourcecode, modify it, and recompile)
But you can of course create your own wrapper-object.
Just create a new class MyString and extend it to your liking with methods
you like.
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|