0

I have a PHP array and I would like to construct similar array in Java.

I have tried using Java arrays, maps and even ArrayList but they didn't gave me the exact structure as in the PHP sample.

Below is the PHP Array Sample:

[name] => Array
    (
        [0] => shoes
        [1] => canvas
    )

What I need is a Java construct which when sent to a PHP script, the script should be able to format it just like the above.

7
  • 1
    See here stackoverflow.com/questions/11097592/convert-array-php-to-java possible duplicate question... Commented May 22, 2017 at 13:35
  • 4
    Possible duplicate of Convert array php to java Commented May 22, 2017 at 13:35
  • 1
    What have you already tried? Please provide a Minimal, Complete, and Verifiable example. Commented May 22, 2017 at 13:36
  • what have you tried?... im kinda confused.. do you need the PHP format ? if thats the case, try $arr = ["name" => ["shoes","canvas"]]; Commented May 22, 2017 at 13:41
  • 1
    so you need Java code correct? I dont work with Java, but I think you should work with JSON. From Java, turn your array into JSON and send it to PHP. PHP will convert that back to an array. Commented May 22, 2017 at 14:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.