
- PHP Tutorial
- PHP - Home
- PHP - Introduction
- PHP - Environment Setup
- PHP - Syntax Overview
- PHP - Variable Types
- PHP - Constants
- PHP - Operator Types
- PHP - Decision Making
- PHP - Loop Types
- PHP - Arrays
- PHP - Strings
- PHP - Web Concepts
- PHP - GET & POST
- PHP - File Inclusion
- PHP - Files & I/O
- PHP - Functions
- PHP - Cookies
- PHP - Sessions
- PHP - Sending Emails
- PHP - File Uploading
- PHP - Coding Standard
- Advanced PHP
- PHP - Predefined Variables
- PHP - Regular Expression
- PHP - Error Handling
- PHP - Bugs Debugging
- PHP - Date & Time
- PHP & MySQL
- PHP & AJAX
- PHP & XML
- PHP - Object Oriented
- PHP - For C Developers
- PHP - For PERL Developers
- PHP Form Examples
- PHP - Form Introduction
- PHP - Validation Example
- PHP - Complete Form
- PHP login Examples
- PHP - Login Example
- PHP - Facebook Login
- PHP - Paypal Integration
- PHP - MySQL Login
- PHP AJAX Examples
- PHP - AJAX Search
- PHP - AJAX XML Parser
- PHP - AJAX Auto Complete Search
- PHP - AJAX RSS Feed Example
- PHP XML Example
- PHP - XML Introduction
- PHP - Simple XML
- PHP - Simple XML GET
- PHP - SAX Parser Example
- PHP - DOM Parser Example
- PHP Frame Works
- PHP - Frame Works
- PHP - Core PHP vs Frame Works
- PHP Design Patterns
- PHP - Design Patterns
- PHP Function Reference
- PHP - Built-In Functions
- PHP Useful Resources
- PHP - Questions & Answers
- PHP - Useful Resources
- PHP - Discussion
PHP - password_hash Function
The password_hash() function can create a password hash.
Syntax
string password_hash( string $password , integer $algo [, array $options ] )
The password_hash() function can create a new password hash using a strong one-way hashing algorithm. The password_hash() function is compatible with crypt() function, therefore, password hashes created by crypt() function can be used with password_hash() function.
Example 1
<?php $passw01 = "53nh46u74m3nt3"; $opts03 = [ "cost" => 15 ]; $hashp03 = password_hash($passw01, PASSWORD_BCRYPT, $opts03); echo strlen($hashp03) . " characters<br>" . $hashp03; ?>
Output
60 characters<br>$2y$15$OyVvzp9NzC7b0x5DHczGzOE2yeyGMdr6.sSszl6X.TZBEdAtyBSGO
Example
<?php $passw01 = "53nh46u74m3nt3"; $opts04 = [ "cost" => 15, "salt" => "salteadoususuueyryy28yyGGtttwqtwtt" ]; $hashp04 = password_hash($passw01, PASSWORD_BCRYPT, $opts04); echo strlen($hashp04) . " characters
" . $hashp04; ?>
Output
60 characters
$2y$15$salteadoususuueyryy28u48viMdUKIwgSc.ETLYvODrrv3MFczPq
php_function_reference.htm
Advertisements