PHP

PHP Menu

PHP

sha1() Function - Definition, Syntax, Parameters, Examples

Definition

The sha1() function calculates the SHA-1 hash of a string.

Syntax

sha1(string, raw)

Parameters

Parameter Description
string Required. The string to be calculated.
raw Optional. Specify hex or binary output format:
true - Raw 20 character binary format
false - Default. 40 character hex number

Example

<?php
$hello = "Hello World!"; echo sha1($hello);

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods