Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在数组中打印数组的元素_Php_Multidimensional Array_Printing_Simplexml - Fatal编程技术网

Php 在数组中打印数组的元素

Php 在数组中打印数组的元素,php,multidimensional-array,printing,simplexml,Php,Multidimensional Array,Printing,Simplexml,这是我的数组结构。我想打印标题和曲目id Array ( [@attributes] => Array ( [type] => array ) [track] => SimpleXMLElement Object ( [id] => 3617316 [created-at] => 2010-06-2

这是我的数组结构。我想打印标题和曲目id

                Array
(
    [@attributes] => Array
        (
            [type] => array
        )

    [track] => SimpleXMLElement Object
        (
            [id] => 3617316
            [created-at] => 2010-06-24T09:09:23Z
            [user-id] => 1219873
            [permalink] => kalimba
            [duration] => 348213
            [commentable] => true
            [state] => finished
            [sharing] => public
            [tag-list] => SimpleXMLElement Object
                (
                )

            [description] => SimpleXMLElement Object
                (
                )

            [streamable] => true
            [downloadable] => false
            [genre] => SimpleXMLElement Object
                (
                )

            [release] => SimpleXMLElement Object
                (
                )

            [purchase-url] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [nil] => true
                        )

                )

            [label-id] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [nil] => true
                        )

                )

            [label-name] => SimpleXMLElement Object
                (
                )

            [isrc] => SimpleXMLElement Object
                (
                )

            [video-url] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [nil] => true
                        )

                )

            [track-type] => demo
            [key-signature] => SimpleXMLElement Object
                (
                )

            [bpm] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [nil] => true
                        )

                )

            [playback-count] => 7
            [download-count] => 0
            [comment-count] => 3
            [favoritings-count] => 0
            [title] => Kalimba
            [release-year] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [nil] => true
                        )

                )

            [release-month] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [nil] => true
                        )

                )

            [release-day] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [nil] => true
                        )

                )

            [original-format] => raw
            [license] => all-rights-reserved
            [uri] => http://api.soundcloud.com/tracks/3617316
            [permalink-url] => http://soundcloud.com/rajanikant/kalimba
            [artwork-url] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [nil] => true
                        )

                )

            [waveform-url] => http://waveforms.soundcloud.com/7eiQ56CHuzwB_m.png
            [user] => SimpleXMLElement Object
                (
                    [id] => 1219873
                    [permalink] => rajanikant
                    [username] => rajanikant
                    [uri] => http://api.soundcloud.com/users/1219873
                    [permalink-url] => http://soundcloud.com/rajanikant
                    [avatar-url] => http://i1.soundcloud.com/avatars-000001390005-a33xqd-large.jpg?77983a
                )

            [stream-url] => http://media.soundcloud.com/stream/7eiQ56CHuzwB
            [download-url] => http://soundcloud.com/rajanikant/kalimba/download
            [downloads-remaining] => 100
            [user-playback-count] => 6
            [user-favorite] => false
        )

)
这样我可以打印,但不会显示记录

<?php echo $me1[1][0];?>

如果对象是
$xml

您需要
$xml->track->id

参考:


如果您的对象是
$xml

您需要
$xml->track->id

参考: