The variable ‘ $salt ‘ plays a crucial role here. It is essentially the ‘key’ to your encrypted string. The salt value will always generate the same values when the same mathematics are applied to it. It provides the constant needed to generate randomness. This goes to say that if someone uses the salt that was used to generate the encryption and applies the same mathematics they can undo or reverse the encrypted string back into the original string text.
In order to decrypt an encrypted string that was generated by using this function use the invoccation code below: