3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sharedKey = hash('sha256','0-120913kassaaa'+floor(time() / 360),true); $encAlgo = MCRYPT_RIJNDAEL_256; $mcryptMode = MCRYPT_MODE_ECB; function encrypt_base64_urlenc($secret, $shared) { return urldecode(base64_decode(rtrim(mcrypt_decrypt( $encAlgo, $shared, $secret, $mcryptMode, mcrypt_create_iv( mcrypt_get_iv_size( $encAlgo, $mcryptMode ) ), MCRYPT_DEV_URANDOM ),'\0'))); } function decrypt_base64_urlenc($secret, $shared) { return rtrim(mcrypt_decrypt( $encAlgo, $shared, base64_decode(urldecode($secret)), $mcryptMode, mcrypt_create_iv( mcrypt_get_iv_size( $encAlgo, $mcryptMode ) ), MCRYPT_DEV_URANDOM ), '\0'); } $derp = encrypt_base64_urlenc("this is a secret",$sharedKey); $underp = decrypt_base64_urlenc($derp,$sharedKey); echo $derp, "\n"; echo $underp, "\n";
Output for 7.2.0 - 7.2.6
Notice: A non well formed numeric value encountered in /in/onENm on line 3 Warning: Use of undefined constant MCRYPT_RIJNDAEL_256 - assumed 'MCRYPT_RIJNDAEL_256' (this will throw an Error in a future version of PHP) in /in/onENm on line 4 Warning: Use of undefined constant MCRYPT_MODE_ECB - assumed 'MCRYPT_MODE_ECB' (this will throw an Error in a future version of PHP) in /in/onENm on line 5 Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/onENm:8 Stack trace: #0 /in/onENm(39): encrypt_base64_urlenc('this is a secre...', '\xA4\x968\xE5\x91\x8A\xDA\x03\x9B\x1D\x04\xE8\x81\xF4\xB0...') #1 {main} thrown in /in/onENm on line 8
Process exited with code 255.
Output for 7.1.0 - 7.1.20
Notice: A non well formed numeric value encountered in /in/onENm on line 3 Notice: Use of undefined constant MCRYPT_RIJNDAEL_256 - assumed 'MCRYPT_RIJNDAEL_256' in /in/onENm on line 4 Notice: Use of undefined constant MCRYPT_MODE_ECB - assumed 'MCRYPT_MODE_ECB' in /in/onENm on line 5 Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/onENm:8 Stack trace: #0 /in/onENm(39): encrypt_base64_urlenc('this is a secre...', '\xA4\x968\xE5\x91\x8A\xDA\x03\x9B\x1D\x04\xE8\x81\xF4\xB0...') #1 {main} thrown in /in/onENm on line 8
Process exited with code 255.
Output for 7.0.6 - 7.0.20
Notice: Use of undefined constant MCRYPT_RIJNDAEL_256 - assumed 'MCRYPT_RIJNDAEL_256' in /in/onENm on line 4 Notice: Use of undefined constant MCRYPT_MODE_ECB - assumed 'MCRYPT_MODE_ECB' in /in/onENm on line 5 Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/onENm:8 Stack trace: #0 /in/onENm(39): encrypt_base64_urlenc('this is a secre...', '\xA4\x968\xE5\x91\x8A\xDA\x03\x9B\x1D\x04\xE8\x81\xF4\xB0...') #1 {main} thrown in /in/onENm on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.5
Notice: Undefined variable: encAlgo in /in/onENm on line 8 Notice: Undefined variable: mcryptMode in /in/onENm on line 8 Notice: Undefined variable: encAlgo in /in/onENm on line 8 Notice: Undefined variable: mcryptMode in /in/onENm on line 8 Warning: mcrypt_get_iv_size(): Module initialization failed in /in/onENm on line 8 Warning: mcrypt_create_iv(): Cannot create an IV with a size of less than 1 or greater than 2147483647 in /in/onENm on line 8 Warning: mcrypt_decrypt() expects at most 5 parameters, 6 given in /in/onENm on line 19 Notice: Undefined variable: encAlgo in /in/onENm on line 24 Notice: Undefined variable: mcryptMode in /in/onENm on line 24 Notice: Undefined variable: encAlgo in /in/onENm on line 24 Notice: Undefined variable: mcryptMode in /in/onENm on line 24 Warning: mcrypt_get_iv_size(): Module initialization failed in /in/onENm on line 24 Warning: mcrypt_create_iv(): Cannot create an IV with a size of less than 1 or greater than 2147483647 in /in/onENm on line 24 Warning: mcrypt_decrypt() expects at most 5 parameters, 6 given in /in/onENm on line 35
Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.5.35 - 5.5.38, 5.6.21 - 5.6.28
Notice: Use of undefined constant MCRYPT_RIJNDAEL_256 - assumed 'MCRYPT_RIJNDAEL_256' in /in/onENm on line 4 Notice: Use of undefined constant MCRYPT_MODE_ECB - assumed 'MCRYPT_MODE_ECB' in /in/onENm on line 5 Fatal error: Call to undefined function mcrypt_decrypt() in /in/onENm on line 8
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.34, 5.6.0 - 5.6.20
Notice: Undefined variable: encAlgo in /in/onENm on line 9 Notice: Undefined variable: mcryptMode in /in/onENm on line 12 Notice: Undefined variable: encAlgo in /in/onENm on line 15 Notice: Undefined variable: mcryptMode in /in/onENm on line 17 Warning: mcrypt_get_iv_size(): Module initialization failed in /in/onENm on line 17 Warning: mcrypt_create_iv(): Cannot create an IV with a size of less than 1 or greater than 2147483647 in /in/onENm on line 18 Warning: mcrypt_decrypt() expects at most 5 parameters, 6 given in /in/onENm on line 20 Notice: Undefined variable: encAlgo in /in/onENm on line 25 Notice: Undefined variable: mcryptMode in /in/onENm on line 28 Notice: Undefined variable: encAlgo in /in/onENm on line 31 Notice: Undefined variable: mcryptMode in /in/onENm on line 33 Warning: mcrypt_get_iv_size(): Module initialization failed in /in/onENm on line 33 Warning: mcrypt_create_iv(): Cannot create an IV with a size of less than 1 or greater than 2147483647 in /in/onENm on line 34 Warning: mcrypt_decrypt() expects at most 5 parameters, 6 given in /in/onENm on line 36
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1
Fatal error: Call to undefined function hash() in /in/onENm on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: hash() in /in/onENm on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: hash() in /in/onENm on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: hash() in /in/onENm on line 3

preferences:
166.95 ms | 401 KiB | 216 Q