From: <php...@li...> - 2014-03-14 18:20:33
|
Hello, I am quite sure this a dumb question but I could not figure how to access the length of java array from php using the JavaBridge. In java: public class TestObject { public TestObject() {} public String[] getStringArray() { return ["a", "b", "c"]; } } In php: $testObject = new Java("my.TestObject"); $results = $testObject->getStringArray(); // trying to find out the length of my array gives an error echo "I have".$results->length."values\n"; //but I can iterate with no error over my results: foreach($results as $result) { echo $result."\n"; } The following code doesn't work and I get an error telling that length is not a member variable of MyObject. Do you have any idea how to get the length from an array of non primitive types from php using JavaBridge ? Should I wrap all my arrays into Collection or ArrayList ? Thank you for your help. Numa |