
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
md5() function in PHP
The md5() function in PHP is used to calculates the md5 hash of a string.
Syntax
md5(str, raw)
Parameters
str − The string to be calculated
raw − Specify Boolean values
TRUE − Raw 16 character binary format
FALSE − Default. 32 character hex number
Return
The md5() function returns the hash as a 32-character hexadecimal number.
Example
The following is an example −
<?php $s = "Welcome!"; echo md5($s); ?>
Output
9a843f20677a52ca79af903123147af0
Example
The following is an example −
<?php $s = "Welcome"; echo md5($s); if (md5($s) == "83218ac34c1834c26781fe4bde918ee4") { echo "
Welcome"; exit; } ?>
Output
83218ac34c1834c26781fe4bde918ee4 Welcome
- Related Articles
- filter_has_var() function in PHP
- filter_id() function in PHP
- filter_input() function in PHP
- filter_input_array() function in PHP
- filter_list() function in PHP
- filter_var_array() function in PHP
- filter_var() function in PHP
- constant() function in PHP
- define() function in PHP
- defined() function in PHP
- die() function in PHP
- eval() function in PHP
- exit() function in PHP
- get_browser() function in PHP
- highlight_file() function in PHP

Advertisements