
Eric Wagener - 2014-05-27 14:51:37
This can be done in a few lines:
<?php
function getToken($chars = 20) {
$letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789*/+-=@#$%&!?;:._\|{[()]}";
return substr(str_shuffle($letters), 0, $chars);
}
BTW: When the function in your class is called repeatedly, the $this->results will get bigger and bigger.