I have this simple one line code:
$thisUserName = is_array($user) ? $user->name : $user;
Here, $thisUserName is giving by $user, means, the condition is_array is returning false, even if print_r is showing that $user is an array.
Any idea, anybody ?
Thanks.
PS. I tried changing that to echo is_array($user) ? 'yes' : 'no' and it is echoing no.
EDIT:
print_r($user) gives
stdClass Object
(
[id] => 169
[name] => Cedric
[username] => pulpfiction
[email] => [email protected]
[password] => c22601b4ed1ac11a80955d6c0eeb1933
[password_clear] =>
[usertype] => Registered
[block] => 0
[sendEmail] => 0
[gid] => 18
[registerDate] => 2013-01-30 11:12:10
[lastvisitDate] => 2013-02-24 19:45:45
[activation] =>
[params] =>
[aid] => 1
[guest] => 0
)
->operator belongs to objects, not arrays, right? Maybe you needis_object() instead? Or maybe you need to use[]` instead of->.