How to use sha256 in php5.3.0

In PHP 5.3.0, you can use the hash function to create a SHA-256 hash. Here's an example of how you can use it:

<?php

$message = 'This is the message to be hashed';
$hash = hash('sha256', $message);
echo $hash;

This will output a string containing the SHA-256 hash of the message.

Watch a course Learn object oriented PHP

Alternatively, you can also use the openssl_digest function to create a SHA-256 hash:

<?php

$message = 'This is the message to be hashed';
$hash = openssl_digest($message, 'sha256');
echo $hash;

Both of these functions will return a string containing the hash of the message.