Home > Backend Development > PHP Tutorial > Examples of md5 and uniqid functions in php

Examples of md5 and uniqid functions in php

WBOY
Release: 2016-07-25 08:56:39
Original
1436 people have browsed it
This article introduces a few small examples of md5 and uniqid functions in PHP for reference by beginners.

1, md5 example

<?
$id = md5(uniqid(rand()));
echo "$id";
?>
Copy after login

2, use md5 function to encrypt text

<?php
   $val = "secret";
   echo "Pre-hash string: $val <br />";
   $hash_val = md5 ($val);
   echo "Hashed outcome: $hash_val";
?>
Copy after login

3, use uniqid function to generate id

<?
$id = uniqid("phpuser");
echo "$id";
?>
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template