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 stdClass 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
제휴하지 않습니다 StackOverflow