Jump to content

[SOLVED] Arrays


SchweppesAle

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.