User login

Boolean comparison operator without an if statement

So it turns out you can use boolean comparison operators without an if statement:

> Anyone know what's happening with this line? the "==" in that spot is
> > completely new to me, and I can't find it in any PHP documentation... I
> > can't imagine it succeeds in doing anything (it doesn't affect the value of
> > $node->community_tags_form when I print it), but as I steal from
> > community_tags I want to be sure I don't remove anything somehow essential...
> >
> >
> > $node->community_tags_form = variable_get('community_tags_display_' .
> > $node->type, COMMUNITY_TAGS_MODE_TAB) == COMMUNITY_TAGS_MODE_INLINE;

this line, just gets the value of

variable_get('community_tags_display_' .
> > $node->type, COMMUNITY_TAGS_MODE_TAB)

compares it to
COMMUNITY_TAGS_MODE_INLINE
and stores the boolean result in $node->community_tags_form

Now I know.

So it turns out you can use boolean comparison operators without an if statement:

> Anyone know what's happening with this line? the "==" in that spot is
> > completely new to me, and I can't find it in any PHP documentation... I
> > can't imagine it succeeds in doing anything (it doesn't affect the value of
> > $node->community_tags_form when I print it), but as I steal from
> > community_tags I want to be sure I don't remove anything somehow essential...
> >
> >
> > $node->community_tags_form = variable_get('community_tags_display_' .
> > $node->type, COMMUNITY_TAGS_MODE_TAB) == COMMUNITY_TAGS_MODE_INLINE;

this line, just gets the value of

variable_get('community_tags_display_' .
> > $node->type, COMMUNITY_TAGS_MODE_TAB)

compares it to
COMMUNITY_TAGS_MODE_INLINE
and stores the boolean result in $node->community_tags_form

Now I know.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.