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 8.4.1
Parse error: syntax error, unexpected token "{", expecting ")" in /in/j8sj5 on line 33
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14
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 7.4.0 - 7.4.33
Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/j8sj5 on line 33 Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /in/j8sj5:6 Stack trace: #0 /in/j8sj5(39): encrypt('1ocguknaus90psu...', '1ocguknaus90psu...') #1 {main} thrown in /in/j8sj5 on line 6
Process exited with code 255.
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /in/j8sj5:6 Stack trace: #0 /in/j8sj5(39): encrypt('1ocguknaus90psu...', '1ocguknaus90psu...') #1 {main} thrown in /in/j8sj5 on line 6
Process exited with code 255.
Output for 7.0.5
VUWQG7lRslhd0UXynp06zsnFmjiC0yvJdwoqugNdKZvvdt/cL3wqBhONWh3lhoe9
Output for 7.0.4
j3tdSk8Qx79flYNS4fT8lytQhw1Lp+4oO9FQgzQY27QxojN+4mtiYkW1YHvL4QpN
Output for 7.0.3
FCkYvpp0mEPmygyosCorTgAG2xHUSZh9hoQ+AKknJSj2yZCh8g5gmYduRQuIB3t2
Output for 7.0.2
ZEiujwzCXoUXUYI4UuCm+/wcbQzxohnihL+0kzwY/4vK5BbQ62Ddh3ezEa1pKUYK
Output for 7.0.1
4QA0GDZy1UaAQcms8T16QGLc+E0BCA+z1w/QVjUOnqLDk6u115Gnk1miAXS2gECU
Output for 7.0.0
5goJLPph+AOMbyVjniIZ63RAgJgjUhDxo6fcodb0iAfgLk0PcvED98Dafp0YbFik
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.35, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_get_block_size() in /in/j8sj5 on line 6
Process exited with code 255.
Output for 5.6.20
LxNcT8VW7Ku4r33cFb1aLhEi4GFDy6ZfSJ62WJ9Fo1vKPcDBTbEmwXC22KpeMch3
Output for 5.6.19
x5jB49PwjGDgFZoKbwkZstwV695Q6IqpnzjMthOCR/0zv7587rlenPxtE58lmE6r
Output for 5.6.18
PZAWsqzTLGXxoojPit6KGrpi8sZMBviykfvkw22O01/p49fiyfAfb9QtflEmnJs9
Output for 5.6.17
AjLp1sREDFBgyK0sZxzLuIGko5q1YRDeao4cQSox1vVFVodt6Gel0I55ZrDG+I8F
Output for 5.6.16
S+drBonefj0VomYRgUQv08e+MYpMzu4rgsQ/gxDUOmRFnuaTm06bOE7j4aoGJebr
Output for 5.6.15
lJh91UirwINmqMPP2GoKbyv7pC0Kzp4I9/pnQpJAB5RrEWDn7nCALZmt21bO7wka
Output for 5.6.14
9ULZ1jU5YRrms6XENUrdzRUPH+X1k7bnW/2F80F2Ki+SVhnt/L5G+ofylKB9NNiH
Output for 5.6.13
Ott0HIQoi7sTSLM80V08mAzn4lBMEmC4dFEs6P3XQ7yY4PKyZyIoGApTHf5Woodd
Output for 5.6.12
NplpevH5U5w/fUXU+IPwssDe7uvoHcdi8gXEDfakGHe7sNqFqd/fuy8hfikU1upJ
Output for 5.6.11
xTZI7UB2I4G5Pe6+VRk3guhDDJ9XEg3mgnqd/5cvDfWjpdOsjDGcqtmkRw8nCplb
Output for 5.6.10
gWlZL6PqkX11UmDY0wk2qAMkh+odLgkOGauXC0Us/BmYjnSSBKwXX+DIWG3iwNxc
Output for 5.6.9
Q8blLlv2B/QoJoLrjZkUqz6PQT6NylPhPDMHm4a9PY/jbbKKmTwD2kwlIRYtK82x
Output for 5.6.8
wQ0inGqE9Igz77CMZYWfC+Zw+6RQqExraS/Q50AuW24z0wqfcb+vpXF/7XPL522I
Output for 5.6.7
BFqOKgdkVAMRBZ3ahEdvb/Ru3eWzb7ca/6Sxpdz/Gv5e5MdP7iG22ShymMbb53Q0
Output for 5.5.34
Bp015trptt+pGd1JXUIR/VYrMItbRVcfW5CUnZUtdgBjpma4DgD2B3HLQwA6cnKb
Output for 5.5.33
W3YzD7D8R/QTH+hCsjgaCCmO1RjG8su5zs0/uW0r9ELK+yF+4UsJGepg7FTLyamV
Output for 5.5.32
k7Q1wK9c3X44G8adOWDyduuu16/GXHo/tYBZZa6ZTmXZWACXf2OlRJLP28487l8V
Output for 5.5.31
Mx86KfdC0UPp21ktojqw22EnNzyIdji0KMQbqwJGFI1DxhHUh+ABPCAPsqk5ZQIp
Output for 5.5.30
sqTAv5nMfeCrZcISgc6kQoDmXzGJimThwqj0IVrpyf3vTqc9/yziX20HQlfu22+W
Output for 5.5.29
Y1fyUskLbbZ88mSzR9vWAdzw2h/xuP1Zi5O/xnCreE9PpwmuFVdDkltDv3gJygIm
Output for 5.5.28
PAgxwm/8xGnIYWF45f7oAO1jBM1bLXolqXwHUySEAOStYtgsjXqzU5Dc9UCbtsuY
Output for 5.5.27
nv84dokE6FJPg7WASuq+VnA+7gzeaPzqf/g/Z5fr/WLNNVxcfH+DoZcFtOokgKtF
Output for 5.5.26
Sw2yIs6x8lsXOZUSt1FMOHHS2rFdfwomOSwt+KG/V3A9qlvr78s82MYD0r4o1NrJ
Output for 5.5.25
/dndu/lurfLt+ItjQEXLmKwXJrlzUDB1xqll7hB23NEa/7NClNqqSqvj03vj3mZG
Output for 5.5.24
9WkGO4SAtnyGNRVoKIJveoUOX7uiYi4Xbv2fnnzloFZxd5t5kdpisRigCaXd6xUw
Output for 5.4.45
E45cpcxoFBHmkwbiRcsBJQlwmxjJTc+l67nXD82sxtVuwdHTE5ezQACzpKeAR50G
Output for 5.4.44
LxUFSPHVmRXHIX3JlIw+VXnfIGRZy2XTpF80e1LM5Wh0SlWNx/FGHZ3jITlTM4pP
Output for 5.4.43
eWlLEKslglELHgD4ZymKlDROD4+2kv6NWDXO+a4wM7goytGrdAyiRNsl9KIOkiKA
Output for 5.4.42
t1x6FLeEo3BGZcWRV0Y/yNMdn7u0eXncsW6A8qoTC4u03jxafGBe1jY9/lSwWVA9
Output for 5.4.41
3SDJKyQkzwVF/jk5ei/ucRJqe+lhgVTMLQO3Bsru8ndRiUkZ8VGjybv+d7wChlBZ
Output for 5.4.40
0kiX5KvbknD75CcbFDhKDM6FZmxCJ3YdYCqo86Yc8e/EbTvhY8vvMoDsn30kX5VY
Output for 5.4.39
LFLf4bc+98Ar9Ipf0Y21MvAj9aqVMvHlhTiLevCiypTmWm4y9yKCmve/vAsFlaA4
Output for 5.4.38
pplkkcme5Py2GWDqWK6L8oTc9o9JpqkrdTfInje4Ezl5FltE5MqX495s5ToTuhjC
Output for 5.4.37
ngv91zfhYBtUHUQ+ZTPR4fxdorD2SbVQ+fuEJjncmUUpTBsZtYUzX6j4oSb6kGwt
Output for 5.4.36
3YYBYuW/qJzbP4a25/mB9J9PuMPNdu3m6s72zrNRljkHuH9DMCXYjG8ZIOemYvdt
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: mcrypt_get_block_size() in /in/j8sj5 on line 6
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: mcrypt_get_block_size() in /in/j8sj5 on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: mcrypt_get_block_size() in /in/j8sj5 on line 6

preferences:
65.99 ms | 473 KiB | 5 Q