3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generatecaptcha(){ $randomcontent = str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789'); $content = null; for($i=0; $i<5; $i++){ $content = $content.$randomcontent[rand(0,60)]; } $image = ImageCreate(46, 17);//width and height imagecolorallocate($image, 0, 0, 0);//get background color for image image, r, g, b $font_color = imagecolorallocate($image, 255, 255, 255); imagestring($image, 10, 0, 0, $content, $font_color);//convert string to image-- image, font-size, x,y, string, font-color return imagejpeg($image); } generatecaptcha(); ?>

preferences:
33.53 ms | 402 KiB | 5 Q