Return to Snippet

Revision: 29930
at August 6, 2010 06:55 by ofadlaoui


Updated Code
<?php
function passToStars($password) {
	//Convert an password into stars (*) with PHP
	//© ofadlaoui @ Snipplr.com
	$password = strlen($password); //lenght of password
	$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;
?>

Revision: 29929
at August 6, 2010 06:53 by ofadlaoui


Updated Code
<?php
function passToStars($password) {
	//Convert an password into stars (*) with PHP
	//© ofadlaoui @ Snipplr.com
	$password = strlen($password); //lenght of password
	$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;
?>

Revision: 29928
at August 5, 2010 06:11 by ofadlaoui


Initial Code
<?php
//Convert an password into stars (*) with PHP
$password = $_GET['pwd']; //password
$password = strlen($password); //lenght of password
$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.
}
echo "Entered password (cens.): " . $stars;
?>

Initial URL


Initial Description
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 !

Initial Title
From password string to stars (*)

Initial Tags


Initial Language
PHP