title: Shuffling php string
body: <p>How can I shuffle the php string?
  I want to show all of the string in the shuffled output.</p>
  
  <p>example input : abc</p>
  
  <p>output : </p>
  
  <pre><code>abc
  acb
  bac
  bca
  cab
  cba
  </code></pre>
  
  <p>my code :</p>
  
  <pre><code>function permutations() {
      global $running;
      global $characters;
      global $bitmask;
      if (count($running) == count($characters)) {
          printf("%s\n", implode($running));
      } else {
          for ($i=0; $i&lt;count($characters); $i++) {
              if ( (($bitmask&gt;&gt;$i)&amp;1) == 0 ) {
                  array_push($running, $characters[$i]);
                  $bitmask |= (1&lt;&lt;$i);
                  permutations();
                  array_pop($running);
              }
          }
      }
  }
  fscanf(STDIN, '%s', $raw_input);
  $characters = str_split($raw_input);
  $running = array();
  $bitmask = 0;
  permutations();
  </code></pre>
  
  <p>always get error for the <code>fscanf()</code></p>