Php 如何添加新的stdClass对象

Php 如何添加新的stdClass对象,php,arrays,object,Php,Arrays,Object,我真的很困惑。通常我使用数组推送向数组添加新数据。但是它不起作用。有人能帮我吗 Array ( [0] => stdClass Object ( [name] => Knijn zijn [artist] => Bertie Lukano [url] => http://www.last.fm/music/Bertie+Lukano/_/Knijn+zijn [streamable] => st

我真的很困惑。通常我使用数组推送向数组添加新数据。但是它不起作用。有人能帮我吗

Array
(
[0] => stdClass Object
    (
        [name] => Knijn zijn
        [artist] => Bertie Lukano
        [url] => http://www.last.fm/music/Bertie+Lukano/_/Knijn+zijn
        [streamable] => stdClass Object
            (
                [text] => 0
                [fulltrack] => 0
            )

        [listeners] => 1
        [mbid] => 
    )

[1] => stdClass Object
    (
        [name] => knijnzijn
        [artist] => Bertie Lukano
        [url] => http://www.last.fm/music/Bertie+Lukano/_/knijnzijn
        [streamable] => stdClass Object
            (
                [text] => 0
                [fulltrack] => 0
            )

        [listeners] => 1
        [mbid] => 
    )

[2] => stdClass Object
    (
        [name] => Wij Vieren Feest
        [artist] => Bertie Lukano
        [url] => http://www.last.fm/music/Bertie+Lukano/_/Wij+Vieren+Feest
        [streamable] => stdClass Object
            (
                [text] => 0
                [fulltrack] => 0
            )

        [listeners] => 1
        [mbid] => 
    )

[3] => stdClass Object
    (
        [name] => Hieper de piep ik heb de mexicaanse griep!
        [artist] => Bertie Lukano
        [url] => http://www.last.fm/music/Bertie+Lukano/_/Hieper+de+piep+ik+heb+de+mexicaanse+griep!
        [streamable] => stdClass Object
            (
                [text] => 0
                [fulltrack] => 0
            )

        [listeners] => 1
        [mbid] => 
    )

)
所以我需要添加一个新的stdClass对象,但我不知道如何添加

[4] => stdClass Object
(
    [name] => name
    [artist] => artist
    [url] => url
    [streamable] => stdClass Object
        (
            [text] => 0
            [fulltrack] => 0
        )

    [listeners] => 1
    [mbid] => 
)
正如你所看到的,在[streamable]中,对象需要是另一个对象,所以我真的不知道怎么做,所以我希望有人能帮助我


谢谢

我会不惜一切代价避免在数组中混合对象,以避免以后的麻烦

通常是这样添加的:

$oData = new stdClass;
$oData->name  = 'Bob';
$oData->email = 'Bob@bob.com';
$aArray = array();
$aArray[] = $oData;
var_dump( $aArray );

您能否将无法使用推送的代码包括在内?