3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CRYPT { public function encrypt($Str,$Key=ENCKEY) { srand(); $Str=str_pad($Str, 32-strlen($Str)); $IVSize=mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $IV=mcrypt_create_iv($IVSize, MCRYPT_RAND); $CryptStr=mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $Key, $Str, MCRYPT_MODE_CBC, $IV); return base64_encode($IV.$CryptStr); } public function decrypt($CryptStr,$Key=ENCKEY) { if ($CryptStr!='') { $IV=substr(base64_decode($CryptStr),0,16); $CryptStr=substr(base64_decode($CryptStr),16); return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $Key, $CryptStr, MCRYPT_MODE_CBC,$IV)); } else { return ''; } } } // class ENCRYPT() $enc = new CRYPT; $s = "test"; //$s = "FGykgbMFQiTpVIRhO9HWL/wXYevfsd7ozE99pbDWge/2Fs8fQb1iqeaw3yAe+kLsmTgPUz7mo/sTfEsvEfldWEx9XU51gsM6T1othRV6rshB9ThE3BOOUKKnhqt/gYyUP6POu5HSr7Rem7TIJIEAPh4w1cTQNN2ZCXyYS4Y+C/8="; $test = $enc->encrypt($s, "w+2#)1FP&LIPTL2<8I2"); echo $test; //echo $enc->decrypt($s, "w+2#)1FP&LIPTL2<8I2");
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_iv_size() in /in/KHqWL:7 Stack trace: #0 /in/KHqWL(28): CRYPT->encrypt('test ...', 'w+2#)1FP&LIPTL2...') #1 {main} thrown in /in/KHqWL on line 7
Process exited with code 255.
Output for 7.0.5
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 32eg0oSNkocX0pRp6H1aUQ==
Output for 7.0.4
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 Ww008FuSEVD9XCa2SaUujg==
Output for 7.0.3
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 4oPFBr/qCv1a1Jm6s37vQg==
Output for 7.0.2
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 PRPxQWADIWdKsOyxwWG90A==
Output for 7.0.1
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 fm5HAJbaOyD7UfIa5PchzQ==
Output for 7.0.0
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 nExvPTEB/rKRmnw3JmvGYA==
Output for 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_get_iv_size() in /in/KHqWL on line 7
Process exited with code 255.
Output for 5.6.20
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 Hx97FVRIOrtBJZNCgHzNuA==
Output for 5.6.19
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 om7HSybUwPHNQIZWZgoVSw==
Output for 5.6.18
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 MuzwwyjXjIc+sF2mUtzkIA==
Output for 5.6.17
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 4BvLgTk7kuBPLrcI1Wg6tw==
Output for 5.6.16
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 Ph3eELmipZTCei/JpXmpkg==
Output for 5.6.15
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 Az+hHbrPoQBtdspP72RMIg==
Output for 5.6.14
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 yWh+imqs3tUYp9GRS3+lFA==
Output for 5.6.13
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 cC6l7lpOyvuFrnF1RW1ayQ==
Output for 5.6.12
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 vFwbMQ6543ckrEj5/KNtIw==
Output for 5.6.11
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 /p6ND+Ql9oO3RsPW/QB8+w==
Output for 5.6.10
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 yMNf4zWAacNG9suidUrEGQ==
Output for 5.6.9
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 +3e5NKyCKL3uASfVOmDVHg==
Output for 5.6.8
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/KHqWL on line 9 hll2We3P8U5JtnebxwHB2Q==
Output for 5.5.34
JcEsGDZEhEg0wnBwooXhxZWgQ3DwCOay4f2ErEIIQd4Zc7KttyWrH6HalZuO4zp3
Output for 5.5.33
MPG9b+Rt1BJeBjwObafLr7Vq0sdcobP3jP8XDQjbfdtCFLaPoWKHlexlDWSMPaI2
Output for 5.5.32
7ckWxaEC6QzcVRTfYkLXvsObwuMgDGimzAjBKziB/jgx7JC59q8ogvQZgNkh46u3
Output for 5.5.31
Z8tRki2ivvbox4GfoX4OU2IbOub2Kk4xKC7BuyUDfRVD2DAALdG1zxLVIWMq8FA8
Output for 5.5.30
r7QD49HA6w4EWLSwoobNdagJSZ2D492AxIFtPb0MOorisngmKG69YAm80LtubCTU
Output for 5.5.29
bzGz3Pw7aeU7u20J9l6C/dFYl6N6IbGHtA3OVIHNhM3Q4uftrwH/bN5A35WdHuP4
Output for 5.5.28
FdF+fDHEBBH2RYeVFaNpr26ywFCNhF8V2sWpUClS9Y3xTJt1YQhObXMKLHA23eqA
Output for 5.5.27
1j65gOn3uWIXbNJiNfT4QCyvoxcbKD1mC2UY/IaCv36r11bZlEgdBO5Hr5dGHdyU
Output for 5.5.26
4+iCovkXzmrqnHwUkkCecc1K5sTxTFTxBwHg7Y7DS92tjOH88bbJZaqDs8kNa0Bp
Output for 5.5.25
a9EJCjcem76+LJDhg0vwGhz/blyvlhnLLU0p5IS7whUWVksG+R+akJ31ElUpgCB8
Output for 5.5.24
t6d/zl89CqOcFb1LbQ07OAKhCzNTy3E2HXjJqB0IIPeYZIN9kvfAR1cNc9X7GNuv

preferences:
156.23 ms | 401 KiB | 183 Q