Referencing returned array elements...



Probably hvaing a major brain-cramp, but here's my problem.

Have a method to a 'word' object, parent() that returns an array of 'wrod' objects that are parents of the current object. i.e.

$word->parent()

returns

array(
[0]=>word Object([word]=>test [syllables]=>1)
[1]=>word Object([word]=>testing [syllables]=>2)
)

Anyways, trying to reference the array elements when calling the function directly, but not sure it's possible.

Here's how I can get it to work:

$temp_var = $word->parent();

then I can reference $temp_var[0] to get that specific object.

I WOULD like to 'chain' the statement a little more though, ala jquery, so I can do more in less space, i.e.

$word->parent()[0]

So I can then do perform other actions on the selected item in the same line, i.e.

$word->parent()[0]->siblings()

etc.

$word->parent()[0] is causing an error of course, just wondering if there is another way to refernce the elements directly after the function call.

Thanks!

.



Relevant Pages

  • Re: Scope of Variant / Array
    ... Since in the immediate window you can reference the array without the parent. ... I've got a form with a linked subform. ...
    (microsoft.public.access.formscoding)
  • Re: offset 1 list indexing
    ... use I follow your "the first element is its own first child". ... "first" refers to the first element of the array being sorted. ... MOV(&temp, array + parent); ... heapSort2(e_type *array, size_t nmemb) ...
    (comp.lang.c)
  • Re: offset 1 list indexing
    ... where the first element is its own first child. ... The array elements are of type. ... MOV(&temp, array + parent); ... heapSort2(e_type *array, size_t nmemb) ...
    (comp.lang.c)
  • Re: Scope of Variant / Array
    ... Even though you declared the array "public" in the main (parent) form, ... a form code module is the same as a class module. ... Constants, fixed-length strings, arrays, user-defined types and Declare ...
    (microsoft.public.access.formscoding)
  • Re: Forth Machine software emulation
    ... ' man is doer \ man has been defined earlier ... but I also want the parent to give ... SWAP CELLS +; PARENT array ...
    (comp.lang.forth)