SQL PHP HTML ASP JavaScript articles and free scripts to download
PHP String Functions

str_shuffle()

A string can be shuffled by using str_shuffle function, here is an example.
$string="abcdefghijk";
echo str_shuffle($string);
The output is here , you can change this by refreshing this page
jabcfghkide

Password geenrator script

We can use this to develop a password generator script where we will create random passwords by using different types of chars. We used substr string function to get short string by taking out first 8 chars of the string only.
Here is the code

$string1="abcdefghijklmnopqrstuvwxyz";
$string2="1234567890";
$string3="!@#$%^&*()_+";
$string=$string1.$string2.$string3;
$string= str_shuffle($string);
echo substr($string,0,8); 
we will get 8 char random string to use as password

gj30w^&6
In above case we have used three stings and added them before shuffling to generate password string. You can add more strings like all uppercase alphabets etc to generate desired password. We can take user inputs also to use the combination of strings to generate random password.

Be the first to post comment on this article :


Google+
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked



HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer