3v4l.org

run code in 300+ PHP versions simultaneously
<?php function base64url_encode($data) { return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); } function base64url_decode($data) { return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); } function encryptCode($data){ return mcrypt_encrypt( MCRYPT_DES , '12345678' , $data , 'cbc' ,'87654321'); } function decryptCode($data){ return mcrypt_decrypt( MCRYPT_DES , '12345678' , $data , 'cbc' ,'87654321'); } $id = 'Q2JmDpmqjNmGT4FJ2EkXXITOgc31ZA52'; $base64Decoded = base64url_decode($id); $decrypted = decryptCode($base64Decoded); print_r($decrypted."\n"); print_r("\n\n"); # Make the new plaintext string $toAdd = 'hellothere'; $additionalCipherText = encryptCode($toAdd); $additionalEncoded = base64url_encode($additionalCipherText); print_r("Additional cipher text:".$additionalEncoded."\n"); print_r("\n\n"); # Concatenate the plaintext and encrypt $plaintext = $decrypted.$toAdd; $cipherText = encryptCode($plaintext); $base64Encoded = base64url_encode($cipherText); print_r(" New cipher text: ".$base64Encoded."\n"); print_r("Original cipher text: ".$id.$additionalEncoded."\n"); # Try the reverse order $plaintext = $toAdd.$decrypted; $cipherText = encryptCode($plaintext); $base64Encoded = base64url_encode($cipherText); print_r(" New cipher text: ".$base64Encoded."\n"); print_r("Original cipher text: ".$additionalEncoded.$id."\n");
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/nv7UJ:16 Stack trace: #0 /in/nv7UJ(21): decryptCode('Cbf\x0E\x99\xAA\x8C\xD9\x86O\x81I\xD8I\x17...') #1 {main} thrown in /in/nv7UJ on line 16
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
20.5 ms | 401 KiB | 8 Q