Re: Java - toString() <-> php - ?
| From: | Adi Zebic | Date: | Tue, 02 Aug 2005 19:09:03 +0000 |
| Subject: | Re: Java - toString() <-> php - ? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219861@lists.php.net to get a copy of this message | ||
Rory Browne a écrit :
I haven't a monkies what that code(your java) does, and I don't have time to analyse it(in expensive cybercafe), but you may want to consider www.php.net/print-r www.php.net/var-dump and www.php.net/var-export I think they may do what you want without using the toString method, which for what you're describing is basicly an ugly hack. One more thing: Enlighten me: What exactly do you mean by "live evolution" in your php/java context.If in php context you have class, say, A: class A { var $t1; var $t2; var $t3; //After, you have object contructor of type A //we have something like this function A ($var1, $var2, $var3) { $this -> t1 = $var1; $this -> t2 = $var2; $this -> t3 = $var3; } ....some other code } //than in some other class we have something like this: class someOtherClass { $aConstructor = new A(1,2,3); //values of t1, t2 and t3 are 1,2 and 3 now } Right? yes. How you can you do something like this inside of "someOtherClass" print ($aConstructor); to finally have some nice output like Value of t1 is 1; Value of t2 is 2; Value of T3 is 3; or just: 1 2 3 Without creating functions like getValues() function getValues() { print ($this -> t1); print ($this -> t2); print ($this -> t3); } and after explicit invoke function: $aConstructor -> getValues(); So, what I want is this: print ($aConstructor); and not this: $aContructor -> getValues(); Am I clear :-) ADI