Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is @ in an object property?

Tags:

php

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?

like image 323
user1173615 Avatar asked Jan 27 '12 14:01

user1173615


1 Answers

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

$object->{'@id'};
like image 86
NikiC Avatar answered Nov 14 '22 23:11

NikiC