3v4l.org

run code in 300+ PHP versions simultaneously
<?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.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.24, 8.2.0 - 8.2.11
Fatal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in /in/Nd8PU:6 Stack trace: #0 {main} thrown in /in/Nd8PU on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Call to undefined function imagecreatetruecolor() in /in/Nd8PU on line 6
Process exited with code 255.

preferences:
236.67 ms | 402 KiB | 397 Q