<?php
function generatePassword($intNumOfChars) {
if (is_numeric($intNumOfChars) && ($intNumOfChars > 0)) {
$strChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
for ($i = 0; $i < $intNumOfChars; $i ++) {
$strPassword .= $strChars[rand(0, strlen($strChars)-1)];
}
}
return $strPassword;
}
?>
PHP – Generate a random password based on length
Don't forget to Subscribe and Follow!
Be sure to subscribe to the feed and follow me on Twitter for more insights and resources!It's Your turn
You
About The Author
Richard is a Web Developer currently working for SankyNet. He is available for freelance work. Visit Shifting Ideas for inquiries. Thanks!
Richard is a Web Developer currently working for SankyNet. He is available for freelance work. Visit Shifting Ideas for inquiries. Thanks!
-
Beware the heat-seeking Nerf machine-gun coming to a cubicle near you http://om.ly/svHF #fb
- Follow me
Last Tweet
-
Archives
Categories
My Favorites
- 37 Signals
- Andrew Warner
- Chris Coyier
- Chris Shiflett
- Collis Ta'eed
- Development Seed
- Drupal
- HubSpot
- James Padolsey
- Joel On Software
- John Resig
- jQuery
- Kevin Rose
- Life Hacker
- Magento
- Mashable
- Matt Cutts
- Matt Ryan
- MySQL
- NetTuts
- Noupe
- Photoshop Tutorials
- PHP
- Smashing Magazine
- Tech Crunch
- WoorkUp
- Wordpress
