3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encrypt($input, $key) { $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $input = pkcs5_pad($input, $size); $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_RAND); $data = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $input, MCRYPT_MODE_CBC, $iv); //$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); //$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND); //mcrypt_generic_init($td, $key, $iv); //$data = mcrypt_generic($td, $iv . $input); //mcrypt_generic_deinit($td); //mcrypt_module_close($td); $data = base64_encode($data); return $data; } function pkcs5_pad ($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } function pkcs5_unpad($text) { $pad = ord($text{strlen($text)-1}); if ($pad > strlen($text)) return false; if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false; return substr($text, 0, -1 * $pad); } echo encrypt("1ocguknaus90psu76h0fnk7efsi9t2e1:tribus123", "1ocguknaus90psu76h0fnk7efsi9t2e1"); ?>
Output for git.master, git.master_jit
Fatal error: Array and string offset access syntax with curly braces is no longer supported in /in/j8sj5 on line 33
Process exited with code 255.
Output for rfc.property-hooks
Parse error: syntax error, unexpected token "{", expecting ")" in /in/j8sj5 on line 33
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:
56.88 ms | 401 KiB | 8 Q