User Tools

Site Tools


php:codesnip:regex-cek-string-password

PHP Cek String Password Mengandung Huruf Besar, Kecil Angka

Berikut ini adalah contoh kode snip php yang berfungsi untuk mengecek panjang password, apakah mengandung huruf besar, huruf kecil dan angka.

Contoh 1

$pass="paswdT6Sa";
$uppercase = preg_match('@[A-Z]@', $pass);
$lowercase = preg_match('@[a-z]@', $pass);
$number    = preg_match('@[0-9]@', $pass);

if(!$uppercase || !$lowercase || !$number || strlen($pass)<=6){
    echo "password harus lebih dari 6 karakter, mengandung huruf BESAR, huruf kecil dan angka";
}else{
    echo "password memenuhi kriteria";
}

Layanan

Harga Domain .COM | Harga Domain .ID | Shared Hosting | Email Hosting | MySQL Hosting |
php/codesnip/regex-cek-string-password.txt · Last modified: 2016/05/13 23:42 by kbadmin

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki