View Single Post
  #1  
Old 07-19-2010, 09:51 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
TGraalVar.toString

So it'd be possible to do something like this...
PHP Code:
temp.blah = new TStaticVar();
temp.blah.toString = function () {
  return 
"Hello";
};
echo(
temp.blah); // this would echo Hello 
This should also work in any case where you do something like (@temp.blah).



It would probably make most sense if by default toString was:
PHP Code:
temp.blah.toString = function () {
  return 
this.name;
}; 
This way there would be no "magic" happening when something gets cast to a string.

Also, this would mean more compatibility with JavaScript.

Last edited by WhiteDragon; 07-19-2010 at 11:56 PM..
Reply With Quote