I have copied source from the answer of this question
and have created this two functions
function my_encrypt($string) {
    $key="1234";
    return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), 
        $string, MCRYPT_MODE_CBC, md5(md5($key))));
}
function my_decrypt($string) {
    $key="1234";
    return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), 
         base64_decode($string), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
}
And when I tried to encrypt and decrypt using the code shown below
 $string="445676467";
    echo $ecr=my_encrypt($string)."<br/>";
    echo my_decrypt($ecr);
The following output is produced
01pEoOCsp7oloZTDMAKF/cxgB0YQFScje6Z8GBXu8Tw=
445676467›HŽÇeVJMç>ÑÑBHc.–ãyeÇN–=“VSã
Wrong with this is that decrypt is not giving correct ouput which is 445676467
but when I tried directly this
$key="1234";
    $string="2011";
    $encrypted= base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, 
        md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));
    $decypted= rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), 
        base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
    echo $encrypted."<br/>";
    echo $decypted;
this gives the correct answer
 
     
     
    
`*. – Palladium Aug 01 '12 at 19:28