Frage

I have a property of a PHP stdClass which starts with an @ symbol (according to my debugger). How do I access its value?

@averageBaseRate = "22.49"
War es hilfreich?

Lösung

Use curly braces:

$obj->{'@averageBaseRate'}

It's the complex (curly) syntax applied to an object.

Using that syntax, you can use any name you want for the member variable.
One can even put really strange Unicode characters in the name.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top