3v4l.org

run code in 300+ PHP versions simultaneously
<? $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 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<? $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.3.32 - 7.3.33, 7.4.26, 7.4.33, 8.0.13
Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() in /in/qXTBE:9 Stack trace: #0 /in/qXTBE(4): simple_encrypt('data') #1 {main} thrown in /in/qXTBE on line 9
Process exited with code 255.
Output for 5.6.8 - 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/qXTBE 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/qXTBE on line 15
Output for 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_encrypt() in /in/qXTBE on line 9
Process exited with code 255.
Output for 5.5.34
����wg������;��(�!93�\�.J��i
Output for 5.5.33
L�k�+���͹�? �/�)�W��*+*p�j�
Output for 5.5.32
e�~�5��}��?%�o{��s{�6iD �W�o ]�
Output for 5.5.31
�K��a*����U3�h048z�7N���pB7[�+
Output for 5.5.30
���ܴ6�Pۋ���"�D������^h8��
Output for 5.5.29
�w_�UZ_/���Q�Z��V���&�D���K�
Output for 5.5.28
�X92K���W������i���gL�k�!
Output for 5.5.27
�qnhH ˼W��JG8�H@� ��^-�m��
Output for 5.5.26
>��"�Uv�e޳��~��9�����-E���
Output for 5.5.25
vv��o�$G��L�;����Ԣ��O���#k'
Output for 5.5.24
Z���H����>��˘����yہ긭�Y�M�
Output for 5.4.45
���}-!0�-w�k��$śS���� �����
Output for 5.4.44
իJY��2�h|�� b���U �#�0]��
Output for 5.4.43
�4�-��ڶa����ZMVf)��p�{U轾��
Output for 5.4.42
�,�"������cq;GX�[{���sO��-���
Output for 5.4.41
0Oo������-��<~d| F`���o*]Ai+
Output for 5.4.40
��l�ɸ��ʒ�2�o3 ��tw3� n���5
Output for 5.4.39
J(ܯy.,�%��r� F��S�H���dwM�?`
Output for 5.4.38
�(���qo�Z�)�ʒ�5 /�2K]N%�
Output for 5.4.37
�D5"�㌾�� *����c\X�ѯ� �Qm�ڔ
Output for 5.4.36
��[��JS�`IB�QK�����,�@��uN
Output for 5.4.35
�3)H��?<�Λ�wAڝ-�' �a>���u�"
Output for 5.4.34
~��Sa��I�I7Y6 ��.��.H�l�",?
Output for 5.4.32
i�w�V�3�#/z�"�o��j<�LMu�
Output for 5.4.31
��'`O- Pwtc�(��|'� ��+k&G )�
Output for 5.4.30
b����+j��$|p� �s�@�4�i5 ��
Output for 5.4.29
�plp��y����6��qDV���ץq��3m
Output for 5.4.28
mW�(�;�i_��o�R��;��ҥ��jok@@
Output for 5.4.27
��?��(.U� ����-����+B��<��Tj<M
Output for 5.4.26
>�A�_�$eK�����*�|�VN���`��n�
Output for 5.4.25
u���l��E��O`�M��vg���CDb�
Output for 5.4.24
���#h3����n ���܀�g��ݒA6��3
Output for 5.4.23
3l� �Wk�6�h4��\YqC5���
Output for 5.4.22
�mn�;R�� �oت3����'�l]e�6���
Output for 5.4.21
EB�&~&VJT�M�6���c G����Q^����
Output for 5.4.20
����+��Z�R�(z�4:e�6_� jD,�qly
Output for 5.4.19
�R�\�����餅�$� � �N��D��L�ȁ
Output for 5.4.18
�h�T�9]�6#L`���춡���,)H�Ӣ�
Output for 5.4.17
|��)��΋������{�>X��Š3�/��@
Output for 5.4.16
���y6�~{ˮ� ��� D!�3��+��K�� �
Output for 5.4.15
���m�BDa����7t���2��D@[ l�j�O�Z
Output for 5.4.14
ȍߦ�e�3>r�/\��t�z�ׅ���
Output for 5.4.13
�{���ih���3Oߒ'+�Б�`f/ ���k�j
Output for 5.4.12
�(���:8z}��#3�k�-J^�LT_1 B�
Output for 5.4.11
$W��� 4|u ���0����zl`�5x
Output for 5.4.10
�C���"j�gڑE�r�W�����\ ��rG�
Output for 5.4.9
�n����NY� �ږH�(���M���a�.
Output for 5.4.8
��۾��v��!D�y� zU���Z�]�G��b��
Output for 5.4.7
t��-�_�@��}��s}��J�w�N�n0�W
Output for 5.4.6
Za��D��jV�����(F� G����lw+L
Output for 5.4.5
B�$S ��:;��h٫1;�T6H��s�t�#�
Output for 5.4.4
�<���}A��2]���q�|�� ߌ(�
Output for 5.4.3
y��ɿi�p ]L4*傿F�P�/�# ��Q� ^
Output for 5.4.2
��6�WNj+��s�<0�A);���v�E���
Output for 5.4.1
-�� -�{I����;�X�vR� E�k�ka�8"
Output for 5.4.0
a���|�Q���!R>�=$���uy��-�

preferences:
236.66 ms | 401 KiB | 359 Q