PHP is a general-purpose scripting language used actively for developing Web applications. At this moment is one of the leaders among the languages used to create dynamic Web sites. Since PHP supports sending and receiving network requests, processing data, and sending emails, it would be strange if this programming language did not support such useful functions for encoding and decoding data using the Base64 algorithm.
To encode data to Base64 in PHP, use the function base64_encode:
<?php echo base64_encode('guru'); //-> "Z3VydQ=="
And of course, the reverse process — to decode Base64 values use the function base64_decode:
<?php echo base64_decode('Z3VydQ=='); //-> "guru"
As you can see, there is nothing complicated. However, if you have any questions, look at the following examples: