From: Michael P. D. <dob...@we...> - 2005-03-26 00:04:20
|
Hi, sorry I need help once more, because I don't get the answer for my question even though I tried it for half a day How can I access the fields of a returned array? Example (here the number of the fields are known before execution, but in my real application the number of the fields are known not until execution): import java.util.*; import java.sql.*; public class javatest { public javatest() { } public static Object test1(String testvar) { Object testobj = null; testobj = new Object(); testobj = testvar; return testobj; } public static Object[] test2(String testvar1, String testvar2) { Object[] testobj = null; testobj = new Object[2]; testobj[0] = testvar1; testobj[1] = testvar2; return testobj; } } <?php $testvar = new Java('javatest'); $testobj1 = $testvar->test1("TestAusgabe1"); print $testobj1.' <br>'; $testobj2 = $ testvar ->test2("TestAusgabe2.1"," TestAusgabe2.2")); print $testobj2[0].' <br>'; print $testobj2.' <br>'; ?> Output: TestAusgabe1 T TestAusgabe2.2 So $testobj2 is not an array but a string which has the second value of test2. I have tried several things to access the first field of testobj2 but without access. So I would be very happy if you have an advice what to do. Many thanks in advance Michael |