Gajanan
Gajanan

Reputation: 1

I need to get NID from the array

array(1) { 
            [0] => object(stdClass)#53 (14) 
                { 
                    ["cart_item_id"]=> string(2) "64" 
                    ["cart_id"]=> string(1) "1" 
                    ["nid"]=> string(3) "204" 
                    ["qty"]=> string(1) "1" 
                    "changed"]=> string(10) "1340948878" 
                    ["data"]=> array(3) 
                        { 
                            ["shippable"]=> string(1) "1" 
                            ["restrict_qty"]=> string(1) "0" 
                            ["module"]=> string(10) "uc_product" 
                        } 
                    ["title"]=> string(5) "songs" 
                    ["vid"]=> string(3) "204" 
                    ["cost"]=> string(9) "123.00000" 
                    ["price"]=> string(9) "123.00000" 
                    ["weight"]=> string(1) "0" 
                    ["weight_units"]=> string(2) "lb" 
                    ["module"]=> string(10) "uc_product" 
                    ["model"]=> string(1) "1" 
                } 
        }

Please help how do get only nid value in new variable.

Upvotes: 0

Views: 78

Answers (1)

xkeshav
xkeshav

Reputation: 54050

get via

$output = $array[0]->nid

access object by ->
access array by [index]

Upvotes: 1

Related Questions