3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /* Не для слабонервных. Давно бросил пхп, но иногда балуюсь. Данный код - сырое превью. Новичкам - лучше вообще не смотреть. */ $Width=500; $Height=300; $img = imageCreate($Width,$Height); $r = rand(5,200);$g = rand(5,200);$b = rand(5,200); $c = imageColorAllocate($img, 255,255,255); imagefilledrectangle($img, 0, 0, $Width, $Height, $c); //-------------------го дотан------------------------// $w = rand(100,150); $h = rand(100,100); $zsize=rand(20,50); $max = rand(2,7)/10; $max2= 0.5; $zxr = rand(-$w/5,$w/5); $zyr = rand(-$h/5,$h/5); $zform = rand(3,8)/10; $mejg = rand($w/2,$w); $zc = imageColorAllocate($img,rand(5,150),rand(5,150),rand(5,150)); $ec = imageColorAllocate($img,$r,$g,$b); $ebc = imageColorAllocate($img,rand(235,255),rand(235,255),rand(230,255)); $eform = rand(90,100)/100; $eform2 = rand(70,100)/100; $rznglaz = rand(80,120)/100; $rznglaz2 = rand(80,120)/100; $smeshx = (500 - ($w*2+$mejg))/2; DrawEye($img, $smeshx+0,0, $w*$rznglaz,$h ,$ec, $ebc, $eform, $eform2, $zxr, $zyr, $zc, $max, $max2, $zform, $zsize); if(rand(0,5)==0) $zc = imageColorAllocate($img,rand(5,150),rand(5,150),rand(5,150)); DrawEye($img, $smeshx+$w + $mejg, 0, $w*$rznglaz2, $h, $ec, $ebc, $eform, $eform2, $zxr, $zyr, $zc, 1-$max, $max2, $zform, $zsize); //imageellipse ( $img , 100 , 100 ,100 , 100 , imageColorAllocate($img,45,45,45) ); //imagefilledellipse ( $img , 200 , 200 ,100 , 100 , imageColorAllocate($img,45,45,45) ); //-----------------и пили симфоню уже-----------------------// header('Content-type: image/png'); imagepng($img); imagedestroy($img); //-------------------------------------------------------// function DrawEye($image, $xx, $yy, $w, $h, $ec, $ebc, $eform, $eform2, $zxr,$zyr, $zc, $max, $max2, $zform, $zsize) { /* if($w<$h) $zsize = $w/3; else $zsize = $h/3; */ DrawEyePoligon($image,$xx-5,95-5,$w+10,$h+10, imageColorAllocate($image,5,5,5), 1, $max, $max2, 0); DrawEyePoligon($image,$xx,95,$w,$h, imageColorAllocate($image,5,5,5), 1, $max, $max2, 1); DrawEyePoligon($image,$xx,100,$w,$h*$eform, $ec, 1, $max, $max2, 1); DrawEyePoligon($image,$xx+10,100+$zform*10,$w-20,$h*$eform2, $ebc, 1, $max2,$max2, 1); DrawEyePoligon($image,$xx+10,100+$zform*10,$w-20,$h*$eform2, $ebc, 1, $max2,$max2, 1); imagefilledellipse ( $image, $xx+$w/2+$zxr,140+$zyr, $zsize, $zsize, $zc); imagefilledellipse ( $image, $xx+$w/2+$zxr,140+$zyr, $zsize * $zform, $zsize*(1-$zform), imageColorAllocate($image,5,5,5)); imagefilledellipse ( $image, $xx+$w/2+$zxr+10,140+$zyr-10, $zsize * 0.5, $zsize*0.5, imageColorAllocate($image,255,255,255)); } //-------------------------------------------------------// function DrawEyePoligon($image, $xx, $yy, $width, $height, $color, $quality, $max, $max2, $fill) { $height/=2; if($quality>$width/2) $quality=$width/2; $points = array(); for($i=0; $i<=$width; $i+=$quality) { $x = $i-$width; $y=($x*$x) / (($width)*($width)) * $height; array_push($points, $i*$max, $y); } for($i=0; $i<=$width; $i+=$quality) { $x = $i; $y=($x*$x) / (($width)*($width)) * $height; //$y=(($width*$width)-($x*$x)) / (($width)*($width)) * $height; array_push($points, $i*(1-$max)+($width*$max), $y); } for($i=0; $i<=$width; $i+=$quality) { $x = $i-$width; $y=-($x*$x) / (($width)*($width)) * $height; array_push($points, $i*$max2, 2*$height+$y); } for($i=0; $i<=$width; $i+=$quality) { $x = $i; $y=-($x*$x) / (($width)*($width)) * $height; //$y=(($width*$width)-($x*$x)) / (($width)*($width)) * $height; array_push($points, $i*(1-$max2)+($width*$max2), 2*$height+$y); } DrawPoligon($image, $xx, $yy, $points, $color, $fill); } //-------------------------------------------------------// function DrawPoligon($image, $x, $y, $points, $color, $fill) { for($i=0; $i<count($points); $i+=2) { $points[$i]+=$x; $points[$i+1]+=$y; } if($fill) imagefilledpolygon($image, $points, count($points)/2, $color); else imagepolygon($image, $points, count($points)/2, $color); }
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function imageCreate() in /in/4LGsl:8 Stack trace: #0 {main} thrown in /in/4LGsl on line 8
Process exited with code 255.
Output for hhvm-3.12.0
�PNG  IHDR�,Ǖ\�$PLTE����V�(�������������JIDATx�흽n�H�� (�` dE� �� mo�H�����%K�ժL�T��6/��_� �?�;B����"GgΙK���?;��p�g�Y j��CuE�]ך��żW��ASJ7 �[�{tu��m������+xw]~S@�j�� ��w�Ko�� O�q P�y?�~[6w��y��wi�wn̗�:�#�ܕ��G�K{Wm?G<��.���/�]9�����ث�q~0ܹ��c�wn�Ľ���I��a஬wmh�x��g�5���{���wΟ��p��=r>xo�� �ܫ(r�5vz,kJ_��݄s�3�ӄs�Q� '��ϩ��b��2�D�}� ��F�����Τ\�����޹+��O<{ˣ���}��P�ꁎ�s�o=�FZ��]���]8�w���a�G��Ӡ;E� >�;�I�C���0v�A���t��{o�� ]I?H�'��Wa�J��˗�λ�<�n�\��H���{�{�A��8������{����q�]�o���nȽu�K>��ݩIG�-ٺ��K���4>���D�:t�i�q���}97���?����П���У�~��x���6t{�� }�nb��u��}�C�<�n�=����~��NYw���O�[b'o���)�l�om��)�~촍��Н����f7�?��ɷ�z��s�هة��}��֙b�>�nc��o)Ž�������Ōu;q��� ��A�Ng��UOXw�_ɺ�����u���N�d� �I0�nC�Vݟ���+��ͳ.����om��y�6v����d]�N�!��5��MZ��[��=:�ßk�U�^�f��\z��v"��t��}�x� =�~ �.O�M�����Z���)/��\ߥ��ƹ��#���}? �/�.�&=�}C�.�O�u�A�]Z����Bi��>X?*��:��#�t�{�K�K�_��t�=�{�����뵎��z�ٷ�����~���ě�;� �u�.�N:�v�E��5_�^� ��^�a��N��`�kԓ[?m������з^���B�{��SI�m�a� O?B��Y��gs�#i��Gu�ՏY�I]���þ��N���k��<�Ŵ~ O� ݼ� �� i��m���:M�κ}GJ?��j|��ߦ�I������/�)HZV}��� n��N��C� �H���ֻ�{�'�=-Ma�/�M(�Џ���>�{b�G����{��q����[o)���#������a���>%Mr����c�����)Ml=^��U'�t;���bQ^�n��wS�-��tKa]7>�.��k}�s���z�}Z�}��fl�aA^�\����5�N�w��C��s�Oq�>�.�ki������ìsA�w�h�ŬsA���=a]�u�O�.e=|�lJ��E�T��!�D㗥ɬ��g['�;|�uʾO6~A����f_�&|[En��n�+Mh=��t}�n|M����=���-��B5>�:Q�sO���S�=���}�m<e�3O<�%Y���{f����xھ��3�[:iEF�iC7�����9��S���x��Ձ����{F�Y��1��;K�M�+���m�[縱S�W�פu�����'�����z�IV6�e�I� :�!'����n���}�!'ٮ45ϐ��t,���nŲ�*��%�Ugt��˻;�yB_u|��l��V-ƮBo8�c��^YN��\y��Xt��/�����9���B_��9��9C_��=��9C7���>;o����쟡;;�1�2sJW ���)]���3�M-{�Ч+�]��L�Do\d��3N��$']��o�!����%>Q4��r���$U�u�l۱��T�%�M�]ɗ���w%]�;@b�Ŝ�ۿ��y[D[R)�� �󦌶�~� mt��� �"���~^�� :#}��E�k��u�Z��_�!7���O}3�nn�ރR�{�AQ�==7�{z���\�;��[�W�6p,���&���>�$�xIEND�B`�
Output for hhvm-3.10.0
�PNG  IHDR�,Ǖ\�$PLTE���fu624��������֪)�IDATx�흽n�D�W�Fڔ&Hа^Vb�u*Dc�}��Jy��\���.S^�����B�y9<���gl�3�7F�朙5��d������2����a}:�?���4��F~mD=�]��H���fI쎟������_��#ݵ�=_懈��s^��< ��B��ܝ��+���؉)7��9���_��Gƾi�zQ|Y���5��_���1�Y���uT�g��F~q��� �2�g��ѣ=ѕ�G9������7$�g9́��ܕ��,-�]�x����n��> �v�o��ב�mH��q�=��KsG���7�i��\��3�|�y[�st�'t��r?1s��<��Ɠ�ۡK��*O�L��8�{l�7v�ٸ� ] �@�L�ww '�8��U�{9ru�+���rg`����6�UV��|�f�I�c�㭥nL)���M&���d�����#�1�n�Q�k��U��#o��YC��g; �gn��Ǫ?w��+�A�lww����^�Z�Ns��g���\w��,v}�{�Ծ�g�ɯ�B���nV>f���ϝ��; �wyN�1�][��Y�!vz��{L㵥�U����m�=u�c�PחzDŽ&�}��F��][�Ӛ>v��uu��~�z砉c'�_BW�������9�m�Iok�BW�/� ������b~yS�}�R� ���:d\��{ocO�ё�r���?��b'w3�0u{�b�;��d��i�}W�Ǫ�+��y_z]�.cl|�����(���E쳪�1Ө��^�Qp��.70�$�]\�咽"vz�:o����!}O�xzp�E�A�]l��Z&i|l�<�@��0�*E�m藨�E���Rs���kz�z��ũ�˫_9�<Eqw���[�u��sb����������΅r�N�[;ݫ��n��q�{{�W�7����k�]�U�b�c�q_��|��ή����=X�J��)e�o���\���M��C�<�cv����y�n��±��bTWp W����Ӧ4c���{G��u�pH]��Ĕ s��t��{.�t��T?���a�OO���)�V��|�˩�=/�F�;�®�91���N���s������E�7 H3,�c�z��\1�.f�Y@����oͯ~ S_���I=�0�о���/��U�ێ��_f�[r��~�[���_��k�z�w�x��ڡ��R���L�3A�?L黼���~ۚ��-�oS��l�Q����o�{^�g����4U��ŭm�w�������\6��"u��Ƴu��ગ�2�>����\�^��˿%���4^��� G=�hm�V��� S=Iߍ����>Pb��WS����� d�w�z�G=���:����n���)��.6����k��^�Y��6�Š���^��5^��E�=�)~�H>NŒ�����ڍ�7�_��^�S���Z㷅�N�-uz�� ý�ԓ�]k�V�óu��У ��{x�� �t}g���� <���5�3�5h��P�"��+���q��{��4Mߵ�n@]����Ͱz���O�=����`�;�V��}R�}P��/���y��Ϥ���̼�|�����&׼�� 5�ݾD��Q�<wMi���C��;}��ŚSkԤO����]���W���zBo�w ��] �:k��;����>�D�6y�����n�N�}�bߺW��s�8����.����}����>��e�Sj�N����R�[�Wю���6?$?���^�A<N��Cgp�Qvָ�C7b�������'�h28���n��ѡ;���a�8�����]�:kN�xNc��]��y�ք�y��C��or��K�c>����k��9��؃T9�њ�y�35�!{���U���9a��y���&�S�&/`�;=�*���Y���^�=ih~n��ٱ��]�'&O�;�Ů�;?<��z�sA��{��){�Y����ل��M������L]�7����h��=��z�n����݄�_Ⳙ�o�!�y�n����MA��|1���yv��Dx�o�/3�6���%(� ;�/��� �,��&G�y H�i=������f��V>6�\��4nF�p��j���C�IEND�B`�
Output for 5.3.0 - 5.6.28
Fatal error: Call to undefined function imageCreate() in /in/4LGsl on line 8
Process exited with code 255.