/ Published in: PHP
This simple snipplr will convert an password string to an censored string by stars (*). Usage:\r\n$myPwdCensored=passToStars(\\\"password\\\");\r\necho $myPwdCensored;\r\nI made this in 5min Comment and FAV ! :-)\r\nMore PHP \"Snipplr\"s coming soon !
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function passToStars($password) { //Convert an password into stars (*) with PHP //© ofadlaoui @ Snipplr.com $number = 0; $stars = ""; //empty string while ($number != $password) //While an number isn't the lenght of the password.. { $stars += "*"; //.. PHP will add an star to the empty string. $number++; //If we don't excecute this, the page $stars will be unlimited. } return $stars; } // Usage: $myPwdCensored=passToStars("password"); echo $myPwdCensored; ?>