You are here: Re: [PHP] Java - toString() <-> php - ? « PHP « IT news, forums, messages
Re: [PHP] Java - toString() <-> php - ?

Posted by Adi Zebic on 08/02/05 22:09

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация