开发者

Getting a value from an object php

I used var_dump on an object in my code. print var_dump( $$user);

result: object(stdClass)#35 (1) { ["user1_ready"]=> string(1) "0" } How do I get to this value (0 in this case).

I tried print $$user which resulted in Catchable fatal error: Object of class stdCla开发者_运维知识库ss could not be converted to string in

I need something like if($$user == 0){echo "error message") else {


You need to use the property/method accessor "->". It generally follows:

$object->method() or $object->property

so yours would be

$$user->user1_ready

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜