Here is a PHP demo script that encrypts and decrypts data:
$encryptionkey = \'h8y2p9d1\'; $card_nbr = \"1234\"; echo \"original card_nbr: $card_nbr &
I think the problem is that you are using binary data when:
mcrypt_encrypt — Encrypts plaintext with given parameters
You can use base64_encode($text) for use plaintext.