What are some common methods for encrypting and decrypting numbers in PHP, especially when using GET variables?

When passing sensitive data like numbers through GET variables in PHP, it is important to encrypt the data to prevent it from being easily tampered with or viewed. One common method for encrypting and decrypting numbers in PHP is using the `openssl_encrypt` and `openssl_decrypt` functions with a secret key. By encrypting the numbers before passing them in the GET variables and decrypting them when receiving them, you can ensure the data remains secure.

// Encrypting the number before passing it in a GET variable
$number = 12345;
$secretKey = 'your_secret_key';
$encryptedNumber = openssl_encrypt($number, 'AES-128-CBC', $secretKey, 0, 'your_iv');

// Passing the encrypted number as a GET variable
$url = 'http://example.com/page.php?data=' . urlencode($encryptedNumber);

// Decrypting the number when receiving it
$encryptedNumber = $_GET['data'];
$decryptedNumber = openssl_decrypt($encryptedNumber, 'AES-128-CBC', $secretKey, 0, 'your_iv');

echo $decryptedNumber; // Output: 12345