Friday, 27 September 2013

Inline conditional statement clarification

Inline conditional statement clarification

I am sorry for the vague question title. I'm not sure what the actual name
of this shorthand method is. If someone wants to help clarify how I should
refer to this, I'll be glad to change the question title.
In the following code snippet:
$account = $value->uid ? user_load($value->uid) : '';
I am a little confused on what this code does. Here is what I think it
does: if $value->uid exists then $account = user_load($value->uid) else
$account = ''
Is that correct?

No comments:

Post a Comment