user1173615
user1173615

Reputation: 63

What is @ in an object property?

I have the following object:

[Suppliers] => stdClass Object
                (
                    [@size] => 1
                    [name] => Supplier Name
                    [Supplier] => stdClass Object
                        (
                            [@chainCode] => EP
                            [@id] => 13
                        )

                )

I know how to get the name property and display it, but I don't know how to get the properties that start with an '@' sign ... What is it and how can I get its value?

Upvotes: 6

Views: 205

Answers (1)

NikiC
NikiC

Reputation: 101956

It's just properties with a somewhat unusual name. You can fetch them like this:

$object->{'@id'};

Upvotes: 13

Related Questions