Here's a little test to separate the serious coders from the cut-and-paste script kiddies. Given the need to generate an arbitrarily long string consisting of random alpha-numeric characters, which solution is best?   Solution A: function randomString($len) {     $chars  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" .               "abcdefghijklmnopqrstuvwxyz" .               "0123456789";     $rndMax = strlen($chars) - 1;     $str = "";     while ($len-- != 0) {         $str .= $chars[rand(0, $rndMax)];     }     return $str; }  $str = randomString(8); echo "$str\n";  Solution B: class RandomSequenceIterator implements Iterator {     protected $seqMembers;     protected $key;     protected $limit;      public function __construct() {         $this->setMembers(null)              ->setLimit(0)              ->rewind();     }      protected function setMembers($strValue) {         $this->seqMembers = $strValue;         return $this;     }...
The Blog of Timothy Boronczyk - running my mouth off one blog post at a time