3v4l.org

run code in 300+ PHP versions simultaneously
<?php $salt ='whatever_you_want'; $en= simple_encrypt('data'); echo simple_decrypt($en); function simple_encrypt($text) { global $salt; return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $text, MCRYPT_MODE_CBC, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_RAND)))); } function simple_decrypt($text) { global $salt; return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_CBC, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_RAND))); }
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 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_encrypt() in /in/g0FRh:9 Stack trace: #0 /in/g0FRh(4): simple_encrypt('data') #1 {main} thrown in /in/g0FRh on line 9
Process exited with code 255.
Output for 5.6.7 - 5.6.20, 7.0.0 - 7.0.5
Warning: mcrypt_encrypt(): Key of size 17 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/g0FRh on line 9 Warning: mcrypt_decrypt(): Key of size 17 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/g0FRh on line 15
Output for 5.3.3 - 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_encrypt() in /in/g0FRh on line 9
Process exited with code 255.
Output for 5.5.34
�'�����&����� &����Ǐ�9,���
Output for 5.5.33
b�+��j�,z8rx�~��~CvmZ�V_BT0
Output for 5.5.32
]V ɌG�'D����<�%D5V�$��Z�Ɣ�#�
Output for 5.5.31
%�ի��ĿQꩢ�:� "- aF��_{s-�:
Output for 5.5.30
��m죙�A�Y�,��Cɟ�mo��u0���,*
Output for 5.5.29
e���/M�ۡ��!(:����l�M؋�!M��k�
Output for 5.5.28
�_l�  \���C�{rn4���ˏ*c��K�Jp
Output for 5.5.27
u��LD�k�v�*�nJ��O�C�R��{�
Output for 5.5.26
��"�/�J�df��(����ОE,��-n�zۃ!
Output for 5.5.25
��{e�C���2�±�Q�Ny��&�=>}�
Output for 5.5.24
j����>#ܒ@�M$�B��n��h� ::��:r��y
Output for 5.4.45
��xܞ��'���K��i���/��P��~z�đ
Output for 5.4.44
귴����T�D�� ;5*��Vy�Y�R��:$��
Output for 5.4.43
�o�{��ey�4�XQ���-\���v\
Output for 5.4.42
W㇆�B�%͢�G�-�j�� �m�n~�0z
Output for 5.4.41
�sc�swE���Zց��_Kl��ͬa<�%�>��
Output for 5.4.40
��So���1�u��t%b<��Ei$U�eq�K
Output for 5.4.39
�T�D鿜�?���I����,�P�43O�� �
Output for 5.4.38
��D��ɺ:{�5 �;r�I(�Vu+�$$Zy�
Output for 5.4.37
�N�!�t ̅W�RB��du4���ͦ*�ԕF�
Output for 5.4.36
�>`��]�!.5�K��~(1+$���?�J�

preferences:
211.87 ms | 401 KiB | 258 Q