Hung up on array processing in PHP

If I have a complex array that contains things like this -
Array
[0] => Array
[0] => Array
[id] => 1234567
[web_id] => 9876543
[something_id] => 656f3953bc
[folder_id] => 0
[title] => Title 1
[type] => regular
[create_time] => Jan 05, 2009 08:39 am
[1] => Array
[id] => 234567
[web_id] => 8765432
[something_id] => 656f3953bc
[folder_id] => 5499
[title] => Title 2
[type] => regular
[create_time] => Dec 09, 2008 03:31 pm
[2] => Array, etc. etc. etc. for another 15 elements
[1] => Array
[0] => Array
[id] => 37214123
[web_id] => 1234552
[something_id] => 2750bd5a64
[folder_id] => 0
[title] => Title 3
[type] => regular
[create_time] => Jan 24, 2009 12:00 am
[1] => Array
[id] => 884174
[web_id] => 477233
[something_id] => 2750bd5a64
[folder_id] => 0
[title] => Title 3
[type] => 0
[create_time] => Jan 23, 2009 09:15 pm
And what I want to do is to step through that inner array,
either for
element 1 or element 2, what would be the best way to do
that? My attempts
at using foreach() here are not working well!
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================

That's what I wanted. Seems simple now. What I had to do was
to strip off
the outer level array.
Thanks, Gary!
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"Gary White" <[email protected]> wrote in message
news:[email protected]..
> On Mon, 26 Jan 2009 12:34:32 -0500, "Murray *ACE*"
> <[email protected]> wrote:
>
>>And what I want to do is to step through that inner
array, either for
>>element 1 or element 2, what would be the best way to
do that? My
>>attempts
>>at using foreach() here are not working well!
>
> Huh? What exactly are you trying to do?
>
> foreach($myarray as $a){
> if (is_array($a)){
> foreach($a as $inner){
> // whatever
> }
> }
> }
>
> Gary

Similar Messages

  • Array processing question

    Hello,
    I am somewhat new to JNI technology and am getting a bit confused about array processing.
    I am developing a C program that is called by a third party application. The third party application expects the C function to have a prototype similar to the following:
    int read_content(char *buffer, int length)
    It is expecting that I read "length" bytes of data from a device and return it to the caller in the buffer provided. I want to implement the device read operation in Java and return the data back to the C 'stub' so that it, in turn can return the data to the caller. What is the most efficient way to get the data from my Java "read_content" method into the caller's buffer? I am getting somewhat confused by the Get<Type>ArrayElements routines and this concepts of pinning, copying and releasing with the Release<Type>ArrayElements routine. Any advice would be helpful... particularly good advice :)
    Thanks

    It seems to me that you probably want to call the Java read_content method using JNI and have it return an array of bytes.
    Since you already have a C buffer provided, you need to copy the data out of the Java array into this C buffer. GetPrimitiveArrayCritical is probably what you want:
    char *myBuf = (char *)((*env)->GetPrimitiveArrayCritical(env, javaDataArray, NULL));
    memcpy(buffer, myBuf, length);
    (*env)->ReleasePrimitiveArrayCritical(env, javaDataArray, myBuf, JNI_ABORT);Given a Java array of bytes javaDataArray, this will copy length bytes out of it and into the C array named buffer. I used JNI_ABORT as the last argument to ReleasePrimitiveArrayCritical because you do not change the array. But you could pass a 0 there also, there would be no observable difference in the behavior.
    Think of it as requesting and releasing a lock on the Java array. When you have no lock, the VM is free to move the array around in memory (and it will do so from time to time). When you use one of the various GetArray functions, this will lock the array so that the VM cannot move it. When you are done with it, you need to release it so the VM can resume normal operations on it. Releasing it also propagates any changes made back to the array. You cannot know whether changes made in native code will be reflected in the Java array until you commit the changes by releasing the array. But since you are not modifying the array, it doesn't make any difference.
    What is most important is that you get the array before you read its elements and that you release it when you are done. That's all that you really need to know :}

  • PHP & array processing

    Hello,
    Can PHP process more rows in ocifetch ?
    regards

    I did a little testing on Windows 2000 using SQL*Plus and client
    libraries from Oracle 9.2. The DB was a 9.2 release on a remote
    machine.
    The SQL script was:
      connect scott/tiger@mydb
      define AS = 1
      prompt Arraysize &AS
      set arraysize &AS
      set pagesize 0
      set linesize 200
      set termout off
      spool c:\temp\bmsp.log
      timing start
      select * from all_objects order by 1;
      spool off
      set termout on
      timing stopThe PHP file was:
      <?php
      require("ScriptTimer.php");  // from user comments on "microtime" man page
      $pfrc = 1;
      $filename = "c:/temp/bmphp.log";
      $conn = OCILogon('scott', 'tiger', 'mydb');
      Script_Timer::Start_Timer();
      if (!$handle = fopen($filename, 'w')) {
        echo "Cannot open file ($filename)";
        exit;
      $query = 'select * from all_objects order by 1';
      $stid = OCIParse($conn, $query);
      OCIExecute($stid);
      OCISetPrefetch($stid, $pfrc);
      while ($succ = OCIFetchInto($stid, $row)) {
        foreach ($row as $item) {
          fwrite($handle, $item." ");
        fwrite($handle, "\n");
      fclose($handle);
      $total_time = Script_Timer::Get_Time(3);
      echo "$pfrc Time was $total_time\n";
      ?>SQL*Plus 9.2 results:
       Time   Arraysize        
       2.1    1000             
       2.1    500              
       2.1    250              
       3.0    100              
       3.0    50               
       4.1    10               
       9.1    1                 PHP (CLI) 4.3.4 results:
       Time   Prefetchrowcount
       4.5    1000           
       4.5    500            
       4.6    250            
       4.7    100            
       4.8    50             
       5.7    10             
       9.2    1               This was a pretty rudimentary benchmark. There are a lot of areas of
    difference between SQL*Plus and PHP that could be debated and
    examined.
    Overall I'm comfortable that PHP's prefetchrowcount has a positive
    effect.
    -- CJ

  • [Error ORABPEL-10039]: invalid xpath expression  - array processing

    hi,
    I am trying to process multiple xml elements
    <assign name="setinsideattributes">
    <copy>
    <from expression="ora:getElement('Receive_1_Read_InputVariable','BILL','/ns2:BILL/ns2:CMS1500['bpws:getVariableData('iterator')']/ns2:HEADER/ns2:SSN')"/>
    <to variable="ssn"/>
    </copy>
    </assign>
    where iterator is a index variable .
    I am getting into this error .
    Error(48):
    [Error ORABPEL-10039]: invalid xpath expression
    [Description]: in line 48 of "D:\OraBPELPM_1\integration\jdev\jdev\mywork\may10-workspace\multixm-catch\multixm-catch.bpel", xpath expression "ora:getElement('Receive_1_Read_InputVariable','BILL','/ns2:BILL/ns2:CMS1500['bpws:getVariableData('iterator')']/ns2:HEADER/ns2:SSN')" specified in <from> is not valid, because XPath query syntax error.
    Syntax error while parsing xpath expression "ora:getElement('Receive_1_Read_InputVariable','BILL','/ns2:BILL/ns2:CMS1500['bpws:getVariableData('iterator')']/ns2:HEADER/ns2:SSN')", at position "77" the exception is Expected: ).
    Please verify the xpath query "ora:getElement('Receive_1_Read_InputVariable','BILL','/ns2:BILL/ns2:CMS1500['bpws:getVariableData('iterator')']/ns2:HEADER/ns2:SSN')" which is defined in BPEL process.
    [Potential fix]: Please make sure the expression is valid.
    any information on how to fix this .
    thanks in advance

    check out this note here
    http://clemensblog.blogspot.com/2006/03/bpel-looping-over-arrays-collections.html
    hth clemens

  • Array Processing in ABAP

    Hi all,
    I am a total newbie in ABAP.
    I need to process an array in ABAP.
    If it was in .NET C#, it will be like this:
    String strArr = new String[5] { "A", "B", "C", "D", "E" };
    int index = -1;
    for (int i=0; i<strArr.length; i++)
       if (myData.equals(strArr<i>))
            index = i;
            break;
    Can someone please convert the above code into ABAP?
    Urgent. Please help. <REMOVED BY MODERATOR>
    THank you.
    Edited by: Alvaro Tejada Galindo on Feb 22, 2008 5:37 PM

    Hi,
    There is no concept of arrays in ABAP, we use internal tables to hold application data. U can use access internal tables with index.
    Read table itab index l_index this is same as u do in case of arrrays a(l_index)
    Instead use an Internal table to
    populate the values and read them ..
    say your Internal table has a field F1 ..
    itab-f1 = 10.
    append itab.
    clear itab.
    itab-f1 = 20.
    append itab.
    clear itab.
    itab-f1 = 30.
    append itab.
    clear itab.
    Now internal table has 3 values ...
    use loop ... endloop to get the values ..
    loop at itab.
    write :/ itab-f1.
    endloop.
    Also you can do this way:
    IT IS POSSIBLE TO DECLARE THE ONE -DIMENSIONAL ARRAY IN ABAP BY USING INTERNAL TABLES.
    EX.)
    DATA: BEGIN OF IT1 OCCURS 10,
    VAR1 TYPE I,
    END OF IT1.
    IT1-VAR1 = 10.
    APPEND IT1.
    IT1-VAR1 = 20.
    APPEND IT1.
    IT1-VAR1 = 30.
    APPEND IT1.
    LOOP AT IT1.
    WRITE:/ IT1-VAR1 COLOR 5.
    END LOOP.
    <REMOVED BY MODERATOR>
    Cheers,
    Chandra Sekhar.
    Edited by: Alvaro Tejada Galindo on Feb 22, 2008 5:38 PM

  • Make Checboxes In To Array In Dreamweaver (PHP)

    Hi guys, am designing a seat reservation system. i want the check boxes to represent the seats
    I want to know how to make each check boxes into array and how to group all the check boxes in a single canvas so that it will store multiple values in one single variable in the database column. there are other texboxes that i want to insert in the same form to get the use booking details.
    If am gona store multiple value in one column how do i identify the check box group?
    Dreamweaver PHP
    <form id="Bookings" name="Bookings" method="post" action="">
      <p>
        <input type="checkbox" name="A1[]" value="1" id="A1[]" />
        <input type="checkbox" name="A2[]" value="2" id="A2[]" />
        <input type="checkbox" name="Ab[]" value="3" id="Ab[]" />
        <input type="checkbox" name="A4[]" value="4" id="A4[]" />
      </p>
      <p>
        <label for="name"></label>
        <input type="text" name="name" id="name" />
      </p>
      <p>
        <label for="Phone_Number"></label>
        <input type="text" name="Phone_Number" id="Phone_Number" />
      </p>
      <p>
        <label for="E_Mail"></label>
        <input type="text" name="E_Mail" id="E_Mail" />

    Hi,
    I would look for a existing script like this:
    http://sourceforge.net/projects/freeseat/
    and implement it in your site, because it takes years of experience to develop something like that.
    These are only a examples I don't know the scripts, but you can look at Github and do a search:
    Example Github:
    https://github.com/fnazmul/Cinema_Seats_Booking_System
    David

  • Array Processing in Forms 6i

    I am developing a common function in a PLL library that requires data from a calling form to be retrieved into temporary arrays on which some processing and calculation takes place and the resultant data is inserted into the destination table.
    In order to do this array manipulation and processing, I know of three options :
    1. Table Type
    2. Record Group
    3. Temporary Tables.
    Which is the best option to use in terms of
    1. Processing speed ,
    2. Client load ,
    3. Server Load,
    4. Multi user processing ,
    5. Re-usability,
    6. Forms 9i compatibility,
    7. Database Interactions
    If there is any other option, apart from the three above, please point out that too. Thanks in advance.

    If you are extracting the data and processing it all from one form, I would use a pl/sql table (Table Type). The coding would be easiest.
    A server side temporary table would give you SQL functionality, but would be much slower than a stand-alone client-side table.

  • Put loop of variables into single array with formatting (PHP)

    I have the following loop;
    <?php
    $i=1;
    while($i<=$num_rows)
    $tempquantity = "extra".$i."quantity";
    $tempcomments = "extra".$i."comments";
    $tempname = "extra".$i."name";
    $tempprice = "extra".$i."price";
    $$tempquantity = $_POST['extra' . $i . 'quantity'];
    $$tempcomments = $_POST['extra' . $i . 'comments'];
    $$tempname = $_POST['extra' . $i . 'name'];
    $$tempprice = $_POST['extra' . $i . 'price'];
    print "Extra name: " . $$tempname;
    print "<br />";
    print "Extra price: " . $$tempprice;
    print "<br />";
    print "Quantity required: " . $$tempquantity;
    print "<br />";
    print "Client comments: " . $$tempcomments;
    print "<br /><br />";
      $i++;
    ?>
    Which, since there are 3 rows, outputs the following;
    Extra name: dfvgfddf
    Extra price: 4
    Quantity required: 67
    Client comments: gtfh
    Extra name: wewew
    Extra price: 34
    Quantity required: 45
    Client comments: thtrt
    Extra name: ewewe
    Extra price: 43
    Quantity required: 12
    Client comments: gdfgg
    What I want to be able to do is show the output above in a PHP email body variable, which I think this means that the loop of varaibles needs to be in one single array variable since coding in an email body variable is not allowed. How do I put a loop of variables like this into a single variable, and how to I keep the <br /> tags and names in front of the varaibles ('Extra name:' etc), so it looks as it should in the PHP email body?
    Thanks in advance

    Hi Murray,
    This is the code that sends the email;
    $to = "$renteremail";
    $subject = "Request confirmation";
    $headers = "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: website";
    $body = "
    Your reference number is <strong>$rrnumber</strong>.
    <br />
    <br />
    Below is a summary of your request details;
    <br /><br /><strong>Accommodation name</strong>: $accomm_name
    <br /><strong>Accommodation type</strong>: $accomm_type
    <br /><strong>Board-type</strong>: $ptbt
    <br /><strong>Max. capacity</strong>: $ptc
    <br /><strong>Check-in date</strong>: $passdate
    <br /><strong>Number of nights</strong>: $passnights
    <br /><br /><strong>Renter's name</strong>: $rentername
    if (mail($to, $subject, $body, $headers)) {$messagesent = 'yes';}
    So the three loop items with their four respective variables should go at the end of the list of variables above after 'Renters name'.
    I also need to put the variables generated by the loop into a single database feild, so if possible all should go into one variable.
    Thanks

  • ARGB to RGB, array processing performance

    I'm trying to use a 2D picture control to display rapidly changing data - I need a decent frame rate.  I'm using the Cairo graphics library to generate the bitmap I want to display and then using a dll call to LabVIEW:MoveBlock to get it to display.  The bitmap is fairly large (720x1366) but Cairo and the MoveBlock seem pretty efficient and their performance is fine.
    The problem is that I need to convert the frame (a 1D array of U32, representing ARGB) to an array of U8 representing R then G then B. This is then converted to a string and sent to the 2D picture control to display.
    I'm using this VI to do the conversion.
    The ARGB and RGB arrays are preallocated.  However, the performance still sucks.  At the moment I'm getting about 16 frames a second and this section of my main loop is taking four times longer than everything else put together.  All I'm trying to do is strip out the alpha channel!  I've tried using masking and bitshifts rather than the split number blocks - no benefit.  I've tried pulling back the original frame as an array of U8 (A then R then G then B) and then using the decimate array and interleave array blocks to filter out the A bytes.  It was slower.
    Any ideas?
    Luke

    The array going into the shift register is already preallocated to the right size (number of pixels * 3).  The ARGB array is sized to the number of pixels.  I've tried various splitting solutions, but it seems the cost of resizing the array into a linear array so I can convert it into a string to send it to the picture control is too great. 
    Here's the code in context:  The ARGB array is grabbed using MoveBlock, processed to just get the RGB values and then formatted to be sent to the picture control.  The picture control is updated after the frame blank is detected, which just about gives flicker free updating.  The slow bits seem to be processing the ARGB array and passing the array to the picture control.  I've tried grabbing the ARGB as an array of A, R, G and B (ie bytes) but this doesn't yield any speed up.  I've also tried not processing it at all and telling the picture control to expect a color depth of 32 rather than 24, and, whilst this works (not documented... Grr NI Grr)  it isn't any faster and gets the colours wrong...
    All I want to do is put an ARGB array on the screen quickly... how hard can it be??

  • DBMS_SQL array processing - ORACLE 8.0.6

    It's been a while since I've used this.
    DEFINE_ARRAY - the last parameter is "lower bound", which is the starting point. If it's set to 1, rows will be placed in the array starting with 1 and ending with the last row fetched. The entire result set from the EXECUTE appears to be loaded into memory using the array. Fetch 1 will retrieve rows 1 - 10, and put them in array loc. 1 - 10, next fetch will return 11 - 20 and put them in array loc 11-20.
    I don't remember it being this way. Why can I not reset the array, load 10 at a time in array locations 1-10, and re-use 1-10 for each fetch? Will I not eventually blow something up if too much is loaded into the array?
    Also, why would I want to set lower bound to anything other than 1? Why would I want to use -10 to 9, or 0 to 20, or other ranges? What purpose does this capability serve?
    (Of course, back then I used host arrays in PRO*COBOL. It must have been different.)
    Thanks.
    KL

    If you do not care about the rows fetched from a prior call to FETCH, you can do a .DELETE on the collection to remove any existing elements and thus freeing the memory.
    The index positions will still start from the next available index position, so you should use .FIRST and .LAST on the collection.
    If you have a set of queries that you run one after the other and these queries produce the end result in the same format as the previous, then you may want to keep the previous rows in the collection, and start from the next available index.

  • Processing a PHP variable in AS3

    I have looked in every book that I have on AS3 and cannot
    come up with a solution to this, I hope that someone can help me.
    I am receiveing a data string from a PHP --- mySQL connection
    on my web server. The string is arriving in flash as I can trace it
    and see the variables. If I do a trace on event.target.data I see
    the following.
    &numResult1=4&numResult2=14&numResult3=37&numResult4=70&numResult5=5&numResult6=3&doneLoad ing=true
    This is exactly what I should be seeing based on my PHP code.
    I am trying to assign the numResult numbers to a dynamic text
    box, for instance numResult1 = 4, I would like to assign that 4 to
    a dynamic text field on the Flash Stage. I have not figured out a
    way to get the variable out of the string.
    I keep getting undefined or a variety or other errors with
    the different methods I try.
    I have tried numerous ways using the URLVariables class but I
    have had no luck. Use to be very simple in AS2, I could assign the
    variable right to the dynamic text field in the properties panel,
    not anymore.
    Does anyone know how I can do this. People are doing it all
    the time, it can't be that hard, is it?????
    Just a good example as to how to break the variables out
    would be really helpful. I have tried the FlashGods site and could
    not figure there examples out, in fact the two I tried did not work
    at all.
    I would appreciate any help.... Thank you.
    Mike

    I have been trying to work this through for over a week, here
    is the ActionScript Code;
    AS
    function getData(event:Event):void {
    var myURLLoader:URLLoader = new URLLoader();
    var myURLRequest:URLRequest = new URLRequest("polls2.php");
    // Actually goes to a web site.
    myURLLoader.dataFormat=URLLoaderDataFormat.TEXT;
    myURLLoader.load(myURLRequest);
    myURLLoader.addEventListener(Event.COMPLETE,
    completeHandler);
    function completeHandler(event:Event):void {
    trace(myURLLoader.data);
    var myURLVariables:URLVariables = new
    URLVariables(myURLLoader.data);
    gotoAndStop(2);
    Here is what I get with the Trace Statement:
    &numResult1=6&numResult2=6&numResult3=5&numResult4=9&numResult5=7&numResult6=1&doneLoading =true
    Here is what I get when I try to set the URL variables.
    Error: Error #2101: The String passed to
    URLVariables.decode() must be a URL-encoded query string containing
    name/value pairs.
    at Error$/throwError()
    at flash.net::URLVariables/decode()
    at flash.net::URLVariables()
    at MethodInfo-2()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()
    Now it sure looks to me that the string being passed is
    name/value pairs.
    I have tried every way that I can think of to capture this
    data. I must be missing something simple.
    Any ideas would be greatly appreciated.
    Thanks for your help.
    Mike

  • Safari not processing local  PHP

    I am editing some php pages and checking them in Safari....4.0.3. On my local machine all I get is code. The page doesn't draw. If I log onto the site the page loads and draws fine. Why won't it work locally?

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled in OS X 10.9 or earlier, or if a firmware password is set, or if the startup volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of the test.

  • 2D Array Processing

    Hi, I've made the following 5x5 array and stored values in it:
    int row = 5;
              int col = 5;
              int[][] twoDarray = new int[row][col];
              int[][] twoDarray =
              {1, 2, 3 ,4, 5},
              {7, -2, 6, 8, -3},
              {1, 90, 3, -1, 0}
              {6, 5, 22, 33, 5}
    I need to print the diagonal values. i.e 1, -2, 3, 7, 5
    and also the opposite diagonal part: 5, 8, 3, 19, 6
    Has anyone got code for this?

    Try this
    class Array2dDiagonals
      int[][] twoDarray ={{1,2,3,4,5},{7,-2,6,8,-3},{1,90,3,-1,0},
                                       {0,19,0,7,0},{6,5,22,33,5}};
      public Array2dDiagonals()
        for(int i = 0, ii = 0; i < twoDarray.length; i++, ii++)
          System.out.print(twoDarray[i][ii]+" ");
        System.out.println();
        for(int i = 0, ii = twoDarray.length-1; i < twoDarray.length; i++, ii--)
          System.out.print(twoDarray[i][ii]+" ");
        System.out.println();
      public static void main(String args[])
        new Array2dDiagonals();
    }

  • How to copy uploaded blob to asset for AMS processing using PHP SDK

    I'm using Azure PHP SDK for Azure Media services and having problem with uploading large files (< 64 mb). So i tried using Blob service to upload as a chunk and commit it as a single file. It also works fine, and now media services won't directly take blob
    as a input. So i need to convert it into an Asset.
    I'm following the link https://msdn.microsoft.com/en-us/library/azure/jj933290.aspx which
    has example using .NET, is there a PHP sdk library support available for copying blob to asset. If yes please let me know the class and its methods or link.
    Please advice
    Mohanraj

    Hi Mohanraj,
    We recently had a fix for the problem you mentioned above:
    https://github.com/Azure/azure-sdk-for-php/commit/972e09c74308411602027280ededb3048b1e2fc4. We will try to release it asap but you can now try to upload by using this code pulled from dev branch.

  • [Discuss] Custom array works like PHP array

    So far, i only tested it with string object and i hope it also work with other object.
    Please give me any suggestion or inform me if have any error.
    class ObjArray
    {   protected Object key[];
        protected Object field[][];
        public ObjArray(Object k[],Object f[][]){   reset(k,f); }
        public void reset(Object k[],Object f[][])
        {   if(k.length<f.length)throw new ArrayIndexOutOfBoundsException();
            key=k;
            field=f;
        public Object[] getKey(){   return key; }
        public Object[] getField(int k){    return field[k];    }
        public Object[] getField(Object k){   return field[getIndex(k)];    }
        public Object getName(int k){   return key[k];  }
        public int getIndex(Object k)
        {   for(int i=0;i<key.length;i++) if(k==key) return i;
    throw new ArrayIndexOutOfBoundsException(); //It should be something to do with the key key.
    public Object getValue(int k,int f){    return field[k][f]; }
    public Object getValue(Object k,int f){ return field[getIndex(k)][f]; }
    public void push(Object k[],Object f[][])
    {   if(k!=null)
    {   Object[] temp=key;
    key=null;
    key=new Object[temp.length+k.length];
    for(int i=0;i<temp.length;i++) key[i]=temp[i];
    int length=temp.length;
    for(int i=0;i<k.length;i++) key[length++]=k[i];
    temp=null;
    if(f!=null)
    {   int length=field.length+f.length;
    if(key.length<length)throw new ArrayIndexOutOfBoundsException();
    Object[][] temp=field;
    field=null;
    field=new Object[length][];
    for(int i=0;i<temp.length;i++)
    {   length=temp[i].length;
    field[i]=new Object[length];
    for(int j=0;j<length;j++) field[i][j]=temp[i][j];
    length=temp.length;
    for(int i=0;i<f.length;i++)
    {   field[length]=new Object[f[i].length];
    for(int j=0;j<f[i].length;j++) field[length][j]=f[i][j];
    length++;
    temp=null;
    public void dump()
    {   for(int i=0;i<key.length;i++)
    {   System.out.println(key[i]+"=>");
    if(i+1>field.length) System.out.println();
    else for(int j=0;j<field[i].length;j++) System.out.println(" "+field[i][j]);
    public static void main(String[] args)
    {   String[] key={"Name","Age","Location","Interest"};
    String[][] field=
    {   {"Max"},
    {"21"},
    {"Net surfing","Gaming","Learning"},
    String[] key2={"Gender","Email","Height","status"};
    String[][] field2=
    {"[email protected]","[email protected]","[email protected]"},
    {"180"},
         ObjArray a=new ObjArray(key,field);
         a.dump();
         System.out.println();
    /*output
    Name=>
         Max
    Age=>
         21
    Location=>
    Interest=>
         Net surfing
         Gaming
         Learning
         a.push(key2,field2);
         a.dump();
         System.out.println();
    /*output
    Name=>
    Max
    Age=>
    21
    Location=>
    Interest=>
    Net surfing
    Gaming
    Learning
    Gender=>
    Email=>
    [email protected]
    [email protected]
    [email protected]
    Height=>
    180
    status=>
         a.reset(key,field);
         a.dump();
         System.out.println();
    /*output
    Name=>
    Max
    Age=>
    21
    Location=>
    Interest=>
    Net surfing
    Gaming
    Learning
         Object[] k=a.getKey();
         for(int i=0;i<k.length;i++) System.out.println(k[i]);
    /*ouput
    Name
    Age
    Location
    Interest
         Object[] f=a.getField(3);
         for(int i=0;i<f.length;i++) System.out.println(f[i]);
    /*output
    Net surfing
    Gaming
    Learning
         Object[] f2=a.getField("Interest");
         for(int i=0;i<f2.length;i++) System.out.println(f2[i]);
    /*output
    Net surfing
    Gaming
    Learning
         System.out.println("getName(3): "+a.getName(3));
    //getName(3): Interest
         System.out.println("getIndex(\"Interest\"): "+a.getIndex("Interest"));
    //getIndex("Interest"): 3
         System.out.println("getValue(3,1): "+a.getValue(3,1));
    //getValue(3,1): Gaming
         System.out.println("getValue(\"Interest\",1): "+a.getValue("Interest",1));
    getValue("Interest",1): Gaming
    If it works as good as expected, i will add  few method(pop,remove,insert,shift,replace...)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    >
    Almost. LinkedHashMap is an associative array that remembers the order of insertion. You can't however directly access it's n-th element.
    And if the value associated with any given key is a list, then it can hold multiple values.
    But: I don't really understand the advantage of being able to access the elements with both a key and an index. It seems pretty fragile to me.

Maybe you are looking for