PHP code example of recycledbeans / is-base64

1. Go to this page and download the library: Download recycledbeans/is-base64 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

recycledbeans / is-base64 example snippets


 

$is_b64 = is_base64('I am not base64-encoded'); // returns false

$is_b64 = is_base64('SSBhbSBiYXNlNjQtZW5jb2RlZAo='); // returns true



$my_encoded_string = is_base64_encode($_REQUEST['could_be_base64_encoded_or_not']); // returns base64-encoded string



$my_encoded_string = is_base64_decode($_REQUEST['could_be_base64_encoded_or_not']); // returns decoded string



$my_encoded_string = $_REQUEST['should_be_encoded'];

if (! is_base64($my_encoded_string)) {

    $my_encoded_string = base64_encode($my_encoded_string);

}