Title: Or in if statement
Last modified: August 21, 2016

---

# Or in if statement

 *  Resolved [hihitavec](https://wordpress.org/support/users/hihitavec/)
 * (@hihitavec)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/or-in-if-statement/)
 * 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.
 * [https://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/or-in-if-statement/#post-4865147)
 * 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.
 * Will
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/or-in-if-statement/#post-4865386)
 * Because there has been no response, I’m assuming the original poster resolved
   the issue.
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/or-in-if-statement/#post-4865387)
 * Hmm, forgot to check the “Mark this topic as resolved” box.
 * So, this extra post to get the thread marked resolved.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Or in if statement’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/or-in-if-statement/#post-4865387)
 * Status: resolved