function _footnotes_helper_randstr in Footnotes 7.2
Same name and namespace in other branches
- 5.2 footnotes.module \_footnotes_helper_randstr()
- 5 footnotes.module \_footnotes_helper_randstr()
- 6.2 footnotes.module \_footnotes_helper_randstr()
- 6 footnotes.module \_footnotes_helper_randstr()
- 7.3 footnotes.module \_footnotes_helper_randstr()
Helper function to return a random text string
Return value
random (lowercase) alphanumeric string
1 call to _footnotes_helper_randstr()
- _footnotes_replace_callback in ./
footnotes.module - Helper function called from preg_replace_callback() above
File
- ./
footnotes.module, line 288 - The Footnotes module is a filter that can be used to insert automatically numbered footnotes into Drupal texts.
Code
function _footnotes_helper_randstr() {
$chars = "abcdefghijklmnopqrstuwxyz1234567890";
$str = "";
//seeding with srand() not neccessary in modern PHP versions
for ($i = 0; $i < 7; $i++) {
$n = rand(0, strlen($chars) - 1);
$str .= substr($chars, $n, 1);
}
return $str;
}