I had a thought this morning whether or not it'd be possible to treat a PHP string as an object, but still initiate the variables the same way.
Using this method would be too easy, and something I wanted to avoid:
$pString = new String('I Love TalkPHP'); echo$pString;
However, I've managed to create it in a way where the following is possible just via PHP. You still deal with the creation of the strings the same way, but it differs in that all strings will now be objects and so interacted with in a different fashion.
$szVariable = 'I Love TalkPHP'; $szVariable->toLowerCase(); echo$szVariable;
Now I am not claiming this to be a good solution, because in actuality it is probably going to be somewhat slow, especially in larger applications. However, it is a nice trick for you just because !
By using the declare function we can traverse through all the variables in the current project, detect if they're strings, and if they are convert them to objects. That is the inner workings in a nutshell. It really is that simple.
Below you can see the code. Hopefully you will be able to work out what's happening, but using this method of working, you can do just about anything.