Free Php Scripts, Articles and Resources
    home  Home   php  PHPscripts   articles  Articles   contact  Contact
Date: 11 March 2010
in

Total scripts: 203
Total downloads: 25493
Total articles: 11

Latest Scripts
Free Contact Us Script +...
Free PHP ODP Script

Top Downloaded Scripts
Captcha Security Images
dGallery

Best Rated Scripts
File Searcher
Transparent Watermark

CATEGORIES

PHP ARTICLES

<< All Php Articles



 
How to generate a random string in php
 
     

You can generate a random string, using the following php function. The function takes as an argument the length of the generated string.

 

    function generateRandomString($length=5)
    {
        $feed = "abcdefghijklmnopqrstuvwxyz0123456789";
        $str = "";
        for ($i=0; $i < $length; $i++)
        {
            $str .= substr($feed, rand(0, strlen($feed)-1), 1);
        }
        return $str;
    }

 

 

 
<< All Php Articles