nested associative arrays

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bill

    nested associative arrays

    The IMAP_headers function returns an associative array.
    for example:
    $head = imap_header($in , ($index+1));
    echo " <br />header:subject :" . $head->subject;

    works fine,
    but $head->from returns an array
    [0]
    [personal]
    [adl]
    [mailbox]
    [host]

    what is the cleanest way of accessing the internally nested
    stuff, personal, mailbox, host ?

    I can do it in multiple lines of code, but I am sure there is a
    proper syntax to get each in one line.

    a ref to a tutorial on arrays would be appreciated, the php.net
    array page is just an index to the functions.

    thanks,

    bill
  • Andy Hassall

    #2
    Re: nested associative arrays

    On Sun, 10 Jun 2007 07:23:54 -0400, bill <nobody@spamcop .netwrote:
    >The IMAP_headers function returns an associative array.
    >for example:
    >$head = imap_header($in , ($index+1));
    echo " <br />header:subject :" . $head->subject;
    >
    >works fine,
    >but $head->from returns an array
    [0]
    [personal]
    [adl]
    [mailbox]
    [host]
    >
    >what is the cleanest way of accessing the internally nested
    >stuff, personal, mailbox, host ?
    >
    >I can do it in multiple lines of code, but I am sure there is a
    >proper syntax to get each in one line.
    >
    >a ref to a tutorial on arrays would be appreciated, the php.net
    >array page is just an index to the functions.


    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • bill

      #3
      Re: nested associative arrays

      Andy Hassall wrote:
      On Sun, 10 Jun 2007 07:23:54 -0400, bill <nobody@spamcop .netwrote:
      >
      >The IMAP_headers function returns an associative array.
      >for example:
      >$head = imap_header($in , ($index+1));
      > echo " <br />header:subject :" . $head->subject;
      >>
      >works fine,
      >but $head->from returns an array
      > [0]
      > [personal]
      > [adl]
      > [mailbox]
      > [host]
      >>
      >what is the cleanest way of accessing the internally nested
      >stuff, personal, mailbox, host ?
      >>
      >I can do it in multiple lines of code, but I am sure there is a
      >proper syntax to get each in one line.
      >>
      >a ref to a tutorial on arrays would be appreciated, the php.net
      >array page is just an index to the functions.
      >

      >
      Thank you.
      What was confusing me was that the array had as it's only element
      an object. Now all is well.

      Comment

      Working...