3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $cipher = 'AES-256-CBC'; // $cipher = 'AES-256-CFB8'; $cipher = OPENSSL_CIPHER_AES_256_CBC; $mode = strtolower(substr($cipher, strrpos($cipher, '-') - strlen($cipher))); $ivSize = openssl_cipher_iv_length($cipher); $blockSize = $ivSize > 0 ? $ivSize : openssl_cipher_iv_length(str_ireplace('-' . $mode, '', $cipher)); var_dump($mode); var_dump($ivSize); var_dump($blockSize);
based on iX0DF
Output for 7.2.0 - 7.3.1
Warning: Use of undefined constant OPENSSL_CIPHER_AES_256_CBC - assumed 'OPENSSL_CIPHER_AES_256_CBC' (this will throw an Error in a future version of PHP) in /in/v7rkp on line 5 Fatal error: Uncaught Error: Call to undefined function openssl_cipher_iv_length() in /in/v7rkp:7 Stack trace: #0 {main} thrown in /in/v7rkp on line 7
Process exited with code 255.
Output for 7.1.20 - 7.1.25
Notice: Use of undefined constant OPENSSL_CIPHER_AES_256_CBC - assumed 'OPENSSL_CIPHER_AES_256_CBC' in /in/v7rkp on line 5 Fatal error: Uncaught Error: Call to undefined function openssl_cipher_iv_length() in /in/v7rkp:7 Stack trace: #0 {main} thrown in /in/v7rkp on line 7
Process exited with code 255.
Output for 5.6.0 - 7.1.7
Warning: openssl_cipher_iv_length(): Unknown cipher algorithm in /in/v7rkp on line 7 Warning: openssl_cipher_iv_length(): Unknown cipher algorithm in /in/v7rkp on line 10 string(1) "7" bool(false) bool(false)