Javatpoint Logo
Javatpoint Logo

PHP string md5_file() Function

PHP string md5_file() function is in-built important function. It is used to calculate the MD5 hash of a file. It uses the RSA Data Security. It returns the md5 hash on success, or FALSE on failure.

Syntax:

Parameter Description Required/Optional
File Specify the file to be calculated. Required
Raw Specify the Boolean hex or binary format.
  • TRUE - Raw 16 character binary format.
  • FALSE - It is default and 32 character hex number.
Optional

Example 1

Save it: "test.txt" file and past it "Hello PHP" string inside the file.

Output:

c540ce201d398a7d275c6e0c669097f3

Example 2

We can store the MD5 hash of "test.txt" in a file:

We can test if "test.txt" has been changed (if the MD5 hash has been changed):

Output:

The file is ok.

Next TopicPHP String





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA