3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php session_start(); // Zufaelligen captchastring erstellen function random_string() { $chars = 'ABCDEFGHKLMNPQRSTUVWXYZ23456789'; $string = ''; $i = 1; $max = 5; while ($i <= $max) { $char = substr($chars,rand(0,strlen($chars)-1),1); $string .= $char; $i++; } return $string; } // captcha code ausgeben function get_captcha() { $old = time()-(60*20); if (empty($_SESSION['captcha'])) return null; if ($_SESSION['captcha']['date'] < $old) return null; return $_SESSION['captcha']['code']; } // captcha erstellen function make_captcha() { unset($_SESSION['captcha']); $string = random_string(); $width = 200; $height = 75; $font = 'captcha.ttf'; $one = imagecreate($width,$height); $two = imagecreate($width,$height); $bgone = imagecolorallocate($one,0,0,0); $txtone = imagecolorallocate($one,255,255,255); $bgtwo = imagecolorallocate($two,255,255,255); $txttwo = imagecolorallocate($two, 0, 0, 0); imagettftext($one,32,0,10,$height-20,$txtone,$font,$string); $y = 0; while ($y < $height) { $x = 0; while ($x < $width) { $r = rand(1,2); if ($r == 1) { $dot = imagecolorat($one,$x,$y); if ($dot == 0) { imagesetpixel($two,$x,$y,$txttwo); imagesetpixel($one,$x,$y,$txtone); } else { imagesetpixel($one,$x,$y,$bgone); imagesetpixel($two,$x,$y,$txttwo); } } $x++; } $y++; } imagecolortransparent($one,$txtone); imagecolortransparent($two,$bgtwo); $old_content = ob_get_contents(); ob_clean(); imagepng($one); $imgone = ob_get_contents(); ob_clean(); imagepng($two); $imgtwo = ob_get_contents(); ob_clean(); echo $old_content; $_SESSION['captcha'] = array('code'=>$string,'date'=>time()); $audiostring = implode('+.', str_split($string)); return '<div style="background-image:url(data:image/png;base64,'. base64_encode($imgone).');background-repeat:no-repeat;background-color:#FFFFFF;width:'.($width).';"><img src="data:image/png;base64,'. base64_encode($imgtwo).'" border="0" /></div>' . '<audio controls autoplay style="width:200px;"><source src="data:audio/mpeg;base64,' . base64_encode(file_get_contents('http://translate.google.com/translate_tts?tl=de&q=' . $audiostring)) . '" type="audio/mpeg"></audio>'; } die(make_captcha());
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function imagecreate() in /in/sukBI:33 Stack trace: #0 /in/sukBI(80): make_captcha() #1 {main} thrown in /in/sukBI on line 33
Process exited with code 255.
Output for hhvm-3.12.0
Warning: No such file or directory in /in/sukBI on line 40 Warning: Invalid font filename captcha.ttf in /in/sukBI on line 40 �PNG  IHDR�K�Z�PLTE���U��~tRNS@��f�IDAT8��a�����[��jY�PT��F��V�b��{�ߧ[�j0c� ��Z`^�N�6=�k�֨�~� T<��\���=�V[5�(_=�Xi(/��|� ��k�*���H"��\��A�%��Y�US�w!vU�-��?�������`�`�O� �̔YV�e�r�q8��f��H���� �|��-u�> ?�&��Z x��N���:� ]!2��Y���6C�=�A>u������Ũ/��7s�����~��M���)�888�\��@�MG�Òᬹ�!����2c 8�+���[-���sK��ABPhjE���]u���\���e/Y�i 9��^�0V8a�>��?m N� �m�BN�B;q�'�^���x ��Kq`�б��(��=&���c���9͸*c�+�\S>F�y��uA}� �fI��k_��U���_�t��=���+\��B�"��H�%L��ɓ���b�d�.�H�Gd�w�I�16G�5�N�Ɩ���^�����b�_���_�,P^�<0��.K���G��9��{t���6gd��A��+&��o�bM �bw�?����Z�@����� �3���&4���k /}�|W��1>�Z0�3Ҝ*<�YU�u �,+akR7�Z���T%� �����b����#���w�����mS��b�m<P\��7��XAf�~6%���y���Nd���Vs����P+�j����1����Ư8J�ܰ��/���E�R:�ݴ��b�K_����� jj�[E�cT�� ��G�����M�~f瞇O�M-���E�3c�@�������%�A:��la�dl��#9�����W��lˣ�.�I�ptk�����NQ���� ��8����,����%�j�n�$�橸��������{��s���{�X~�1�l��$h��׳G&��EO�R�ME���tQ �y5y$�(C�ԧ�p+3mAP���q�1�K�a&����H~�l�-���+5]��eN@���v"ک�d?�]:�3>��}`��^ڏ���R�%Cj�Y�{��wt (n�Գ�c;���ݟ�g��O�<I�'�j� ���K�n�_ �n���]8@:��[$��ZVki��j�f�f�#^��ۥ-��Y b� 7m�����.J�+�.��=HX����q@>��Nn�b�R�-[7㨭�������Z����{�7FM�Aۣ0��?(��6Ǽ�F�N�0B3q>F)^����*�ʪ�1\}�H8�h �@@��k��-^���ꆘ��f���!�wi(�$f����".�2[��,w�=�����[�V�f?*��Fn�N�l��+�AsX̅�����x��H���$�S!#Ȏ�T�;�����1ׅ� .�[B �h'���9`�W�s�����Rj�J!=�p A��'��I@� �U��a�h�3���^�I��d/�2������Y�9' �����e��� � �c���%���t��ˌu��k�n>Ȼ��B��2��(���a,���/�ah*`Ć cY�� ���g^|�fs�X�v�^7DbL=O/�r���*3�5�6 T򶵏*�$F:�:�y|�.l��H} ��JI�ZS�O���L>k�\0K�Ͻ� 2�$ �$��ϛ�2:��f�Or���@�y��e7��r 쌔�ʯ����n>��g�Z�R�\5S� ˽��p��3ƒaқ+37��F��� �I����ż�W � �$&H}@?���D�䙀��~v��|�ۋ���J&�f�nӽ%Ү�5o�[�`S���CХ�L���#)x@l�$�m��� #Pb�<��Ȣ�5�;XZ��ȱ=���IEND�B`��PNG  IHDR�K�Z�PLTE���U��~tRNS@��f�IDAT8��a�3�[Iu�s���[��w�n��N�6 X�n��������l���<���&�V)W r�m��Q2�5�X���Rנ��d����h�2�l��$�S'���r�|9�� c�����]��މ��gd�l���'�> w�d�/�&��3k������p���VQ�V�Tc��`��rbҊ����Jm��-8�^G��n���<%�CDɼO����MMY�OC:W�;)��_���gu������wY�!��f<mSF ��Uh͜���ca��vm3����j ��ᯗ��j%��ITb�Hr*�Ц>���`3�(�ϩǞ)�Go��� �n��Y����Ďa�H���>y���v�/N�*��wi��4$U�nv9�2G՜�����z�U'���x�X���P;����Zlh��a�3���� K,ԣf=�L�B$��ڳEl6l]}� u��|�g���0�� �ɸ�w�x9i\p�PiX�n�c���(�ӯ�`��jrѴf'�>�h�4�q���Y/�ɘ�u_�����=3����N��n��as<.�+�X�V�tY0;&�R�`**���+��Ђ+�� M/���5���-c���T���^���h�Ԟ�����; ��j�Y^JH�U4�8�%�4�L6'���JR��ï�y,�F~���z���>G�>,��9 �r��ig|&��x�Sn�.c@$9Pǵv#OE���_���{"K?*�.�� �^DH�����S�䜫E��%�&�YMwlb��'����ax�H���d�e̜�HCxOq�I~�P��pK��H��oD���9�/*�B��4\_�[� ���4=�tGV��[��W<��m:�[ ��P?ڀu�A�\�iVG�Yq4;-4��K_�K�j�1����S�l�9ۗwO(L��P7��B�t��FA���C�ʆ��o׼A+X,��̒辯o��V�&��& �Cj��\�1�x,8���0$���m_<��%V�S��s��z�A��B�%p�/�k��Kڼ��p��W�k��ב+L�y��{_"`�F��'�nL&ö�d�X�J�M$ �C�n���1�dTF������fE��s����HE��7�p�[ܡ<�{$Z�f>��^���Ȓ0 / ѵ� ��·�Kcen����H����|���[Ҥ�WR$+.u�_p4�,ȹ�L��$\���l"��8�8C_��&Ͻ̎��֡A/��5UZΣ�A��f��M���/�c�-ҡC>�Xyg6�Qw?�9�������OG3��~ͤKӈT��FB �)�A���iV���d�w�)�Y�|�錧3znAd8�*�A{#������7qT� �.��(z ��p����r��_ Ɵf�?�<�FM�0��B���g���N�G!��W�9��k*�G��[^]�x�K�0����MoLI&�v���B@zV�v^�5� �[ �Fza�uB4s�c_�N��7D�'`�U_� 4�*j��9/�����;y�R,�wUk���0������=�X��Ȼ��°��OKY���"��|�߫ IJp�۹� �"��Lѓ  ���Q.�����Q�urB���y��관 {0BB������EI0d4��?��D���0��s�uY��f2��sk 5P9�����I�I�[�ʬk����4BD�}��Z�=|��-d���V�Z.�J��Y�vw_:C4����[�ٷ���\-�?f��|Z�$tHv(��`�n�,B���-Qʐl�@��0"-�/Zf��H6�և� �C�5#,����ܯ��!>7]�7ħ� -����,IEND�B`� Warning: Failed to open http://translate.google.com/translate_tts?tl=de&q=R+.3+.X+.Y+.K (Could not resolve host: translate.google.com) in /in/sukBI on line 77 <div style="background-image:url(data:image/png;base64,);background-repeat:no-repeat;background-color:#FFFFFF;width:200;"><img src="data:image/png;base64," border="0" /></div><audio controls autoplay style="width:200px;"><source src="data:audio/mpeg;base64," type="audio/mpeg"></audio>
Output for hhvm-3.10.0
Warning: No such file or directory in /in/sukBI on line 40 Warning: Invalid font filename captcha.ttf in /in/sukBI on line 40 �PNG  IHDR�K�Z�PLTE���U��~tRNS@��f�IDAT8��a����.ȯ�0){Ez?��/��9��A^�@%t^� D�A|�gq1�<;(sc�BLУ ���Z� �`��2 x�VO� b0�T����õ�F�L���KH��c:��d�5Q!nay��PG��e�� S�� C�"$<qg��>�3��SpoޥR3��O{C1Ⱥ�6v�����"�lc�!�Nw���K&����sxI�j9 �-2����O9����-��;���Ҍ ��u4nL��b�0%�H�5��h���_�]比1���QQ���H"}�/��V��Ʊ�D2�Eᘂ�|Zf�4����z1/�L�����+?h��3�G �y��!P����bU�H�a��R_b�F�;O���zT�3W� ��> @4���"�q_�5�.;�i�:;�V���x�jE��ي���˗\����5���v��T P�k"wZ��m�(L��aZ�]p��oͱ����v/$���Fz�Z�8�V<�n�ơCVL#���� ���I��g��$���a�W �]N��^ �� y�S8�^x�a��&�3����N���z �2���(m Hã�y��㜢���Tذi����}��1��F7���P�f���.rɸ�>��� 0)����ՙdI���Ƕ�,?�X�A�(S�S|0'��}�����?��遄��U�F��q���$Gx`�W�m��){~���U�~���rkO�1�j#Õ%�x��w��ϑMM�� +t[�j�z��vH}��p���*:5��}p(�}Q�$9C�_���*��z�t�%P�c/#g���e�Z���'! ��Z�����R_�r'?��R��&�9{c�C]�i�n�?��#���>���D�N/��� �œ�R 1���� jv0��&*|�+�ޱ��Cm�y�#�`�T�ϓ��:��]�M��{�H�RTa>G����o���g�R*B��vNP��k�J��,�G�هb�C�03I~��dO����[�~���9��"�tM�.w���[�蚁<�a�'�-(�o���+_b���3�Cλ�s�Eʭq�C�i Hs����9����b��#����Q���N_�ڵ�+ �����c�|��E�o�`3C �m�ղ��a3A𳛂qE8�J.8��dP����[�z!2���G8�@�mېQ{ZS%�.%��Q��72�b��$4��s���;.�%��ԯ����P�����}Da���S%(���w�Mo�?�C�^Ӆo�wI��[z����[���y���*�D�9�^3�����i{�ص0(�)����_2l��x�h�P�0�����)�o8�d��'3�#�S���2P\�#�q;���W�.��TxX@��  ���V�<X�~���(�}�b�9�Qq�ƑAU9v�{nB� gSU����ܠƣ�+~�k݋��֕�Yh{/M��՝�� �*G6}w}�Y�, �򧡣�е,�si(+��j�_|*�G�wp���Qz��5�E]�"}����?uR²_���$[��u�^Bt��/q\�j���}x�J�'��j���1�����yy��.���i|�N�� ^r ��~Z`��7(HmUO��������Z�9*uh@�ӑ�_P:�|�� 6��6|'2�Ig��D*� ��� ���? q����>���4L�oJ��I(9c�������� o�d9<wrpUn������ڟ>Z��]�?s�qO9��a�������C���rfw�C��{��q�3�O�S�;�0���;�cD lZ�u��K��k�Z׼��沼l{�<�j)��� �W!�ߩ@N���e��`�摵����&lM��z_$ծP< �"7�[IEND�B`��PNG  IHDR�K�Z�PLTE���U��~tRNS@��f�IDAT8��a�a�Yk�7P��ք���[�J �9 O��'�ڋ��U��)��K���j�����H��/\�oW%��@�j[�߇_����:�OiHP�<J#�0�E�\���!���KZ�.ʮ�ޑ���%��^��n�]�z��q��Î�.�J��E���!Z��J����7E|�ɉj�}cb�l�������)?9��&n���`��p��8<��]�U&�5�s����-6-s�g�ˑ��� �����J-�V��/�Pk�e���vN+�݂k�^'�\79Nh��G�g}1����C7�fv���i�~Fin�[)���4����� �l|ޯ_H)���w�+���M�c�İaZ>텫��|�|����:K#�?���D�n��K�"��$�zD+�T��w7&uqB4h�UGlr�9�og�@>�����舥��ei���#��Z��N��!�2NA_�>����g��U�4�_���9�a�9^����|dm �3�j�5�y�f�(�$ ���2��o袱dE��'� �r��e���z�,U�C�P~�)�@� ��<�`>2?��߷<\s�u7c]g\�]��'O�X]R�h#��-��23���Z��=qэ6G]�[lj���x .*f��p��o78Iu��>�L�7׬$������=�E19�5~{�4�+�,3�"8۸���1�Waք�\�I�t�a���r�S��<j�[� �u<0n��Zz����-��xA�����b}o������Xw���u���@�Ƽ�@���}H?�I2�,�kگ`���ܘA�x�:��Hg!���6��]`Z�b��hZ����e{�jƄ�A��,�9�[�[���0�pL�$%�Q���~$5�q:lz���)� ��)"ߕ��(�Ճ+�`!N���50��D���S��J0lc%�]W��_m��Y�����q` l�V8 �c�սQh�z!��d`��c�e&x�E�">��̶�WH��a<=�S�<�k��s���шB~���e~���}��k��E&|Ԡ�NO*�U�1D���5R�� �J��roA�plJG� ��E1#Y�LM�H���M%JL�fMG8�k��U�)$���̼��<sF� *M�̾Ld}���-���fd���_J�����t���~�$o�����b���qX��4��>x���Y�{�_|���ym+P @�]JnyK�⻞ov�U���5�I��o�1�H�,z���3(��QpX9�{6�;�\� � ��q!^}�d��Q'J����y�}{�O�͓o���N�f���=�e/�O��d�Y ��.���m��ͯ�@�"��iT��m���� L���u1c��,ç�ee� ����V��~9n���ƉE���򘬪[L��YJ#_9\@ԁ�"tEw)j}�藄в}9*bK��;ոɂ��W�U��W X^\O/J�>����l|�o������E����o�}캢4�݂�tR]>����=M�J;ۤ[W�k���jЎ�?�,���6�p8>�X �jN�s]F��^/��qF^��G�?X���QW���~e�׀����I $�x�\Y-�&�Պ��a,n2���O�4�� b�Ƀ������I�c��3�j4�=�L�ߎBPaG�,˳h��Ls��ƜMPNy>ZP����È���Q�_@Ha%`��i��>��b���:#�l6% 3�1�u �i����&�:�YP�m��z�C��EbQ�,���y�u��9�I��(C�MC��>��.��{!@�x���- V��.6�Z��IX�nJ3��X ٓ�4.����*Q����cƮ�IEND�B`� Warning: Failed to open http://translate.google.com/translate_tts?tl=de&q=T+.3+.8+.X+.W (Could not resolve host: translate.google.com) in /in/sukBI on line 77 <div style="background-image:url(data:image/png;base64,);background-repeat:no-repeat;background-color:#FFFFFF;width:200;"><img src="data:image/png;base64," border="0" /></div><audio controls autoplay style="width:200px;"><source src="data:audio/mpeg;base64," type="audio/mpeg"></audio>
Output for 5.2.3 - 5.6.28
Fatal error: Call to undefined function imagecreate() in /in/sukBI on line 33
Process exited with code 255.
Output for 5.0.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/sukBI on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/sukBI:2) in /in/sukBI on line 2 Fatal error: Call to undefined function imagecreate() in /in/sukBI on line 33
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: session_start(): Cannot send session cookie - headers already sent in /in/sukBI on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/sukBI:2) in /in/sukBI on line 2 Fatal error: Call to undefined function: imagecreate() in /in/sukBI on line 33
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Warning: session_start(): Cannot send session cookie - headers already sent in /in/sukBI on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/sukBI:2) in /in/sukBI on line 2 Fatal error: Call to undefined function: imagecreate() in /in/sukBI on line 33
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent in /in/sukBI on line 2 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/sukBI:2) in /in/sukBI on line 2 Fatal error: Call to undefined function: imagecreate() in /in/sukBI on line 33