문제

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"
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top