title: I would like to know how to combine If, AND and OR in a complex statement in PHP
body: <p>I have a problem I would like some help with. I am generating random numbers to convert to a password using chr($v). I am using an if statement to make sure I only use printable characters. I have got this successfully working in C++ for Arduino and Pascal using Lazarus for Windows &amp; Linux. I am now trying to write a Web based version and cannot get the code below to work, in either form in PHP 7.3. The first one is the one that works in C++ and Pascal, although in Pascal I have to use the words AND and OR!
  Any help would be greatly appreciated!!
  Many thanks.</p>
  <pre><code>if (($v &gt; 47) &amp;&amp; ($v &lt; 58)) || (($v &gt; 64) &amp;&amp; ($v &lt;91)) || (($v &gt; 96) &amp;&amp; ($v &lt; 123))
  </code></pre>
  <pre><code>if ($v &gt; 47 &amp;&amp; $v &lt; 58) || ($v &gt; 64 &amp;&amp; $v &lt;91) || ($v &gt; 96 &amp;&amp; $v &lt; 123)
  </code></pre>