hello guys.,
I need small help from. I am a java developer and am not well acquainted with php. I am developing a java application which calls a php web service (sugar CRM soap webservice)., so one of the web service method (login) takes a php struct as a parameter, user_auth which has three parameters username, password and version, all of them are strings. Can any one tell me what will be the output structured like when we print out the user_auth struct.
I tried:
1) String user1 = "user_auth{username=will; password=18218139eec55d83cf82679934e5cd75; version=1.0;}";
2) String user2 = "{'user_auth':{'username':'will','password':'18218139eec55d83cf82679934e5cd75', 'version':'1.0'}}";
Does any of the above strings match the output of a struct in php? If not what should it be like??
This would be of a great help for me if any one can tell me whats the right now.
Thanks,
aspr
PHP Struct
Moderator: General Moderators
Re: PHP Struct
PHP doesn't use the concept of a struct, as C does (and probably Java, I'm not a Java programmer). I believe that if you are expecting a struct, PHP probably sends an array, but someone else is likely to give you a more reliable answer.
Re: PHP Struct
If its an array which one of those closely match the java strings?
Re: PHP Struct
I'm not sure what you mean. As far as I know, an array is the same in any language. It's a data structure that can be indexed either by its position (array[0], array[1], etc. for a one-dimensional array) or by a key value (array['key1']['red'], array['key2']['green'], etc. for a 2-dimensional array).asprsai wrote:If its an array which one of those closely match the java strings?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: PHP Struct
All scalars in PHP are essentially strings. You can use an associative array or an object to hold the values. It looks like you are using JSON above describing objects. PHP has a JSON library that can convert either arrays or objects.
(#10850)
Re: PHP Struct
If this login() function is the one in question, I believe the answer is
Whitespace is irrelevant.
Code: Select all
$user_auth = array (
'username' => 'will',
'password' => '18218139eec55d83cf82679934e5cd75',
'version' => '1.0'
);I interpreted that as "syntax of an array".asprsai wrote:output of a struct