title: Generate Random Password without these characters "l1o0"
body: <p>I need to generate random password with condition:</p>
  
  <ul>
  <li>All characters are allowable except "<strong>l1o0</strong>"</li>
  <li>Length of 8 to 12 in characters</li>
  </ul>
  
  <p>Codes I've tried:</p>
  
  <pre><code>function generateRandomPassword() {
    //Initialize the random password
    $password = '';
  
    //Initialize a random desired length
    $desired_length = rand(8, 12);
  
    for($length = 0; $length &lt; $desired_length; $length++) {
      //Append a random ASCII character (including symbols)
      $password .= chr(rand(32, 126));
    }
  
    return $password;
  }
  </code></pre>
  
  <p>How to avoid these 4 characters => "<strong>l1o0</strong>" ? </p>
  
  <p><strong>Reason:</strong> </p>
  
  <ul>
  <li>These 4 characters are sometimes confused the user. </li>
  </ul>
  
  <p>Thanks!</p>