PHP Conditional

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rob B
    Senior Member
    • Dec 2005
    • 311
    • 3.6.x

    PHP Conditional

    PHP Code:
    if ($vbulletin->userinfo['field29'] == "Yes"
    If I made that:

    PHP Code:
    if ($vbulletin->userinfo['field29'] == "Yes" OR ""
    would it work. If not, what would be the correct way of doing this?

    Thanks for any help
  • Andy Huang
    Senior Member
    • Feb 2004
    • 4602

    #2
    it should be:
    PHP Code:
    if (($vbulletin->userinfo['field29'] == "Yes") OR ($vbulletin->userinfo['field29']  == "")) 
    Best Regards,
    Andy Huang

    Comment

    • Rob B
      Senior Member
      • Dec 2005
      • 311
      • 3.6.x

      #3
      Thanks

      Comment

      • Lats
        Senior Member
        • Mar 2002
        • 3671

        #4
        If field29 ever has additional options, it will be easier to maintain using the array approach...
        PHP Code:
        if(in_array($vbulletin->userinfo['field29'], array("","Yes","Maybe","Perhaps"))) 
        Lats...

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...