Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs down Convert from Java to PHP

    Hi All,

    I have scoured the net and still have not been able to find anything that would help me with this. I want to convert this
    Code:
    MapEntry[] myData = new MapEntry[2];
    myData[0] = new MapEntry();
    myData[0].setKey("first");
    myData[0].setValue("My first name");
    myData[1] = new MapEntry();
    myData[1].setKey("last");
    myData[1].setValue("My last name");
    to php. I tried the following but the API I am does not appear to like it.
    PHP Code:
    $subscriber_data = array();
    $subscriber_data = array('firstName' => 'JM','lastName' => 'TEST'); 
    Thanks in advance!

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    PHP Code:
    $subscriber_data = array('firstName' => 'JM','lastName' => 'TEST');
    print_r($subscriber_data); 
    That's all you need

  • #3
    New Coder
    Join Date
    Jul 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks NF,

    That's what I figured but the guys who created the API said it may be the problem.

  • #4
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Or more similar:

    PHP Code:
    $myData = array();
    $myData['first'] = 'My first name';
    $myData['last'] = 'My last name'
    You'll find that PHP is a lot shorter/more flexible.

  • #5
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    providing some details of the API might help...
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •