Perl to php

I want to convert this to php

Code (text):

$password = md5_base64($password);

I tried this but failed

$password =  md5($password);
$password = base64_encode($password);

I’m tired and need to head off now, but maybe?

$password =  md5($password, true);
$password = base64_encode($password); 

http://perldoc.perl.org/Digest/MD5.html

Same as md5(), but will return the digest as a base64 encoded string. The length of the returned string will be 22 and it will only contain characters from this set: ‘A’…‘Z’, ‘a’…‘z’, ‘0’…‘9’, ‘+’ and ‘/’.

http://www.php.net/md5

If the optional raw_output is set to TRUE, then the md5 digest is instead returned in raw binary format with a length of 16.

http://php.net/manual/en/function.base64-encode.php

Thanks solved using this way

$data=preg_replace('/=+$/','',base64_encode(pack('H*',md5($data))));

Well md5 nowadays is no longer secure enough to encrypt your data, instead you should try sha1, or even sha512 unless you have to compensate for old data already encrypted using md5.