>Since the PHP array type is not directly compatible with a HashMap -
>even though they are basically the same concept of key/value pairs -
>you have to be careful when moving values back and forth between the
>two. I have found that building a PHP array with all the values I
>need first and then using a simple FOREACH loop to populate my Java
>HashMap works great. Here's an example:
>
><?php
>...
>// build a request array
>$request['key1'] = "value1";
>$request['key2'] = "true";
>$request['key3'] = 2342;
>$request['key4'] = "internet";
>
>// == Prepare the request HashMap for Java ==
>$j_request = new Java("java.util.HashMap");
>foreach ($request AS $key => $val) {
> $j_request->put($key,stripslashes($val));
>}
>
Thanks for the reply Jon. That's pretty much what I planned on doing. Am I
correct that those issues
are specifically with HashMaps, seeing as directly converting php arrays to
a Vector seems to
work ok? Thanks again.
Tom
_________________________________________________________________
Try the next generation of search with Windows Live Search today!
http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&source=hmtagline
|