PHP

PHP Menu

PHP

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

Definition

The sha1_file() function calculates the SHA-1 hash of a file.

Syntax

sha1_file(file, raw)

Parameters

Parameter Description
file Required. The file to be calculated.
raw Optional. A boolean value that specifies hex or binary output format:
true - Raw 20 character binary format
false - Default. 40 character hex number

Example

<?php

$sha1file = sha1_file("sample.txt");
file_put_contents("sha1file.txt",$sha1file);

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods