title: Inline if/else statement of JavaScript in PHP
body: <p>I have a file written in PHP. I would like to have inline if/else statements of JavaScript in PHP. Is it possible? An example is given below:</p>
  
  <pre><code>    &lt;?php
  
       echo "&lt;script type=\"text/javascript\"&gt;
               function myFunction(a, b) {
                        if(a&gt;b)
                            return true;
                        else
                            return false;
                         }
  
                if(myFunction(3,2)) { "; 
                       $x = '/index';
                echo "} else { ";
                             $x = '/index2';
                       echo "}";
       echo "&lt;/script&gt;";
  
       ?&gt;
  </code></pre>