Same name and namespace in other branches
  1. 6.x includes/bootstrap.inc \drupal_base64_encode()

Returns a URL-safe, base64 encoded version of the supplied string.

Parameters

$string: The string to convert to base64.

Return value

string

1 call to drupal_base64_encode()
drupal_random_key in includes/bootstrap.inc
Returns a URL-safe, base64 encoded string of highly randomized bytes (over the full 8-bit range).

File

includes/bootstrap.inc, line 2302
Functions that need to be loaded on every Drupal request.

Code

function drupal_base64_encode($string) {
  $data = base64_encode($string);

  // Modify the output so it's safe to use in URLs.
  return strtr($data, array(
    '+' => '-',
    '/' => '_',
    '=' => '',
  ));
}