![]() |
function random_string in string_helper - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: function random_string in string_helper (/showthread.php?tid=67011) |
function random_string in string_helper - lisheng51 - 01-02-2017 PHP Code: return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len); Is not better with this way: substr(str_shuffle($pool), 0, $len); it is even faster than substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len); ?? RE: function random_string in string_helper - Wouter60 - 01-02-2017 It's not clear what your question is. What do you want to know about random_string() ? RE: function random_string in string_helper - Narf - 01-03-2017 He wants to suggest changes to it. No, these changes don't make it better. In fact, nothing will make it better. That function is fundamentally broken. |