title: PHP - assigning function return to variable
body: <p>I have a PHP script that returns a random password.  How do I echo out the password that is generated?</p>
  
  <pre><code>&lt;?php
  
  function generatePassword($length=9, $strength=0) {
      $vowels = 'aeuy';
      $consonants = 'bdghjmnpqrstvz';
      if ($strength &amp; 1) {
          $consonants .= 'BDGHJLMNPQRSTVWXZ';
      }
      if ($strength &amp; 2) {
          $vowels .= "AEUY";
      }
      if ($strength &amp; 4) {
          $consonants .= '23456789';
      }
      if ($strength &amp; 8) {
          $consonants .= '@#$%';
      }
  
      $password = '';
      $alt = time() % 2;
      for ($i = 0; $i &lt; $length; $i++) {
          if ($alt == 1) {
              $password .= $consonants[(rand() % strlen($consonants))];
              $alt = 0;
          } else {
              $password .= $vowels[(rand() % strlen($vowels))];
              $alt = 1;
          }
      }
      return $password;
  }
  
  ?&gt;
  </code></pre>