Jump to content

Recommended Posts

I receive the following output through var_dump:

 

array(59) {
  [0]=>
  array(16) {
    [0]=>
    object(SimpleXMLElement)#11 (2) {
      ["@attributes"]=>
      array(1) {
        ["id"]=>
        string(12) "subscriberid"
      }
      [0]=>
      string(32) "0306750863bcfb1ea1eb15065a9789f7"

 

echo some_array[0][0];

 

returns the string "0306750863bcfb1ea1eb15065a9789f7"

 

How would I instead reference the string "subscriberid"?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/175156-solved-arrays/
Share on other sites

 

how's this?

Array
(
    [0] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => subscriberid
                        )

                    [0] => 0306750863bcfb1ea1eb15065a9789f7
                )

            [1] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => subscribedate
                        )

                    [0] => 2009-08-27
                )

            [2] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => unsubscribedate
                        )

                    [0] => 2009-08-27
                )

Link to comment
https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923143
Share on other sites

using the context/example you supplied

 

it would be

echo some_array[0]['@attributes']['id'];

 

*plants head on desk*  really thought that one would work.  lol, nothing still though

 

echo $stream_users[0]['@attributes']['id'];

 

I've tried the other suggestions as well. 

Link to comment
https://forums.phpfreaks.com/topic/175156-solved-arrays/#findComment-923512
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.