Insert PHP
[resolved] Or in if statement (4 posts)

  1. hihitavec
    Posted 2 years ago #

    I have problem with or in if statement. If I use this code:

    $var = 1;
    $var2 = 5;
    if($var == 3 || $var2 == 5){
      echo "works";

    Then it will display works, but at the end there will also display all code.


  2. WillBontrager
    Plugin Author

    Posted 2 years ago #

    hihitavec, Testing it on my site, if find the vertical bar or ("||") is causing it.

    Insert PHP runs the code by putting it into an eval(). It seems "||" and "|" need special handling and I don't have the answer immediately.

    If you can use "or" instead of "||" then it should work.


  3. WillBontrager
    Plugin Author

    Posted 1 year ago #

    Because there has been no response, I'm assuming the original poster resolved the issue.

  4. WillBontrager
    Plugin Author

    Posted 1 year ago #

    Hmm, forgot to check the "Mark this topic as resolved" box.

    So, this extra post to get the thread marked resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Insert PHP
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.