3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header("Content-type: image/png"); $sizex=800; $sizey=800; $img = imagecreatetruecolor(3 * $sizex,$sizey); $r = imagecolorallocate($img,255, 0, 0); $g = imagecolorallocate($img,0, 255, 0); $b = imagecolorallocate($img,0, 0, 255); imagefilledrectangle($img, 0, 0, 3 * $sizex, $sizey, imagecolorallocate($img, 255, 255, 255)); $p = 0; for($i=0; $i < 100000; $i++) { $np = rand(0,$sizex); imagesetpixel($img, $p, $np, $r); $p = $np; } $p = 0; for($i=0; $i < 100000; $i++) { $np = mt_rand(0,$sizex); imagesetpixel($img, $p + $sizex, $np, $g); $p = $np; } $p = 0; for($i=0; $i < 100000; $i++) { $np = floor($sizex*(hexdec(bin2hex(openssl_random_pseudo_bytes(4)))/0xffffffff)); imagesetpixel($img, $p + (2*$sizex), $np, $b); $p = $np; } imagepng($img); imagedestroy($img);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in /in/LSAue:6 Stack trace: #0 {main} thrown in /in/LSAue on line 6
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Call to undefined function imagecreatetruecolor() in /in/LSAue on line 6
Process exited with code 255.